Home
> FlashEff 2.0 Flex
> Topic
Effect on an image in a canvas: bug
Posted by knbmedia
Effect on an image in a canvas: bug December 11, 2009 09:38AM | Registered: 15 years ago Posts: 3 |
Hi,
I use Flex 3 (sdk 3.3 or 3.4)
I have a problem when using some preset on a pattern like FESAlpha on an image in a canvas
In order to show the "bug", i create a minimum mxml application (see sources) like this:
I have a canvas ( w/h:600/400 x/y:100/100)
In this canvas, i have an image.
When loadComplete is dispatched, I use FESAlpha to show the image using canvas.addChild(myEffect).
test1.mxml:
With preset 13 (default), it works fine
test2.mxml :
with another preset (ex: 1, left to right), it doesn't (nothing appears and TRANSITION_END is not dispatched)
test2_workaround.mxml
If my canvas width is set to 908 (or higher), it works ! (with value near 908, sometimes it works, sometimes it doesn't work)
test3.mxml:
Same as test1, but with preset=5 (B+L2T+R): it doesn't work
test3_workaround.mxml
If my canvas size is set to w=1006 and y=952, it works !
So it seems that depending on the parent canvas with and height and the image x/y and the effect gradientWidth, the effect is bugging...
I have just opened a new Ticket for this issue
I use Flex 3 (sdk 3.3 or 3.4)
I have a problem when using some preset on a pattern like FESAlpha on an image in a canvas
In order to show the "bug", i create a minimum mxml application (see sources) like this:
I have a canvas ( w/h:600/400 x/y:100/100)
In this canvas, i have an image.
When loadComplete is dispatched, I use FESAlpha to show the image using canvas.addChild(myEffect).
test1.mxml:
With preset 13 (default), it works fine
test2.mxml :
with another preset (ex: 1, left to right), it doesn't (nothing appears and TRANSITION_END is not dispatched)
test2_workaround.mxml
If my canvas width is set to 908 (or higher), it works ! (with value near 908, sometimes it works, sometimes it doesn't work)
test3.mxml:
Same as test1, but with preset=5 (B+L2T+R): it doesn't work
test3_workaround.mxml
If my canvas size is set to w=1006 and y=952, it works !
So it seems that depending on the parent canvas with and height and the image x/y and the effect gradientWidth, the effect is bugging...
I have just opened a new Ticket for this issue
Re: Effect on an image in a canvas: bug December 14, 2009 03:31PM | Registered: 15 years ago Posts: 5 |
Hi there,
I took a look at your examples, and I found a workaround for resolving this.
An explication for this is: FlashEff has an integrated future that when it is removed from stage, it clear itself. Canvas has another feature that when the content is bigger that its dimenstions, it creates the scrollable pane, so it removes all the children and moves to another container - so activates flasheff's feature. To prevent this(FlashEFf's feature), see the code bellow (modified content is marked with Bold).
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="[www.adobe.com]; layout="absolute" frameRate="30" viewSourceURL="srcview/index.html">
<!--
Test 3 workaround : in order to work, i need to change canvas width to 1006px or more AND height to 952 or more
Important : when width/height are near these values (ex: width =1005 or 1007), sometimes it works, sometimes it doesn't ... so try lower/higher values to see the bug/workaround
-->
<mx:Canvas width="1007" height="1007" x="100" y="100" backgroundColor="#aaaaaa" id="canvas1">
<mx:Image width="400" height="292" source="../bin-debug/myImage.jpg" id="myImage" autoLoad="true" scaleContent="true" complete="loadComplete()" x="100" y="100"/>
</mx:Canvas>
<mx:Script>
<![CDATA[
import FlashEff2Flex;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;
import com.jumpeye.Events.FLASHEFFEvents;
private var myEffect:FlashEff2Flex;
private var showEffect:FESAlpha;
private function loadComplete():void {
myEffect = new FlashEff2Flex();
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, endShowEffect);
showEffect = new FESAlpha();
showEffect.tweenDuration = 2;
showEffect.preset=5; // B+L2T+R
showEffect.gradientWidth=10;
myEffect.showTransition = showEffect;
canvas1.addChild(myEffect);
myEffect.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStg,false,0xFF,true)
myEffect._targetInstanceName = "myImage";
//myEffect.showDelay = 2
}
private function removedFromStg(ev:Event):void{
ev.stopImmediatePropagation();
myEffect.removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStg)
}
private function endShowEffect(evt:FLASHEFFEvents):void {
var effectInstance:FlashEff2Flex = evt.target as FlashEff2Flex;
trace("end");
}
]]>
</mx:Script>
</mx:Application>
I took a look at your examples, and I found a workaround for resolving this.
An explication for this is: FlashEff has an integrated future that when it is removed from stage, it clear itself. Canvas has another feature that when the content is bigger that its dimenstions, it creates the scrollable pane, so it removes all the children and moves to another container - so activates flasheff's feature. To prevent this(FlashEFf's feature), see the code bellow (modified content is marked with Bold).
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="[www.adobe.com]; layout="absolute" frameRate="30" viewSourceURL="srcview/index.html">
<!--
Test 3 workaround : in order to work, i need to change canvas width to 1006px or more AND height to 952 or more
Important : when width/height are near these values (ex: width =1005 or 1007), sometimes it works, sometimes it doesn't ... so try lower/higher values to see the bug/workaround
-->
<mx:Canvas width="1007" height="1007" x="100" y="100" backgroundColor="#aaaaaa" id="canvas1">
<mx:Image width="400" height="292" source="../bin-debug/myImage.jpg" id="myImage" autoLoad="true" scaleContent="true" complete="loadComplete()" x="100" y="100"/>
</mx:Canvas>
<mx:Script>
<![CDATA[
import FlashEff2Flex;
import com.jumpeye.flashEff2.symbol.alpha.FESAlpha;
import com.jumpeye.Events.FLASHEFFEvents;
private var myEffect:FlashEff2Flex;
private var showEffect:FESAlpha;
private function loadComplete():void {
myEffect = new FlashEff2Flex();
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, endShowEffect);
showEffect = new FESAlpha();
showEffect.tweenDuration = 2;
showEffect.preset=5; // B+L2T+R
showEffect.gradientWidth=10;
myEffect.showTransition = showEffect;
canvas1.addChild(myEffect);
myEffect.addEventListener(Event.REMOVED_FROM_STAGE, removedFromStg,false,0xFF,true)
myEffect._targetInstanceName = "myImage";
//myEffect.showDelay = 2
}
private function removedFromStg(ev:Event):void{
ev.stopImmediatePropagation();
myEffect.removeEventListener(Event.REMOVED_FROM_STAGE, removedFromStg)
}
private function endShowEffect(evt:FLASHEFFEvents):void {
var effectInstance:FlashEff2Flex = evt.target as FlashEff2Flex;
trace("end");
}
]]>
</mx:Script>
</mx:Application>
Re: Effect on an image in a canvas: bug December 16, 2009 08:35AM | Registered: 15 years ago Posts: 3 |
Sorry, you do not have permission to post/reply in this forum.