Home
> FlashEff 2.0
> Topic
reassigning effect via flashEff2Code instance to many clips.
Posted by raystudio
reassigning effect via flashEff2Code instance to many clips. July 01, 2010 09:08PM | Registered: 13 years ago Posts: 9 |
I want to find out if i can have one instance of effect and apply it to other clip after the effect is done. Trying to make some slideshow by showing clips one by one - this in a loop but somehow first one works but the rest just shows clips but the effect is not applied to them.
To clarify the task i just put clips to an array and when the effect ends: TRANSITION_END event occurs i try to assign new effect by:
myEffect.target = clip_arr[counter];//where counter is just a var increasing everytime the TRANSITION_END is dispatched.
Can i do something like that or need I dynamically create another instance of flashEff2Code and assign it to next clip?
Thanks for reading:)
To clarify the task i just put clips to an array and when the effect ends: TRANSITION_END event occurs i try to assign new effect by:
myEffect.target = clip_arr[counter];//where counter is just a var increasing everytime the TRANSITION_END is dispatched.
Can i do something like that or need I dynamically create another instance of flashEff2Code and assign it to next clip?
Thanks for reading:)
Re: reassigning effect via flashEff2Code instance to many clips. July 02, 2010 10:22AM | Admin Registered: 16 years ago Posts: 547 |
Re: reassigning effect via flashEff2Code instance to many clips. July 05, 2010 03:58PM | Registered: 14 years ago Posts: 31 |
Re: reassigning effect via flashEff2Code instance to many clips. July 06, 2010 06:27AM | Admin Registered: 16 years ago Posts: 547 |
This is was a particular problem and I can say for certain that will work in your case as well.
In this example we had 3 clips on the stage and we applied on each one of them an effect.
We couldn't see the effects how it worked, because the second and third clip was underneath the first one. So, by calling this method you practically, bring the clip on which you apply the effect on top position.
If you have a similar problem you need to call setChildIndex method on the flasheff and add it to top position after you set the target on the flasheff.
e.g this.setChildIndex(flasheffInstance, this.numChildren-1)
In this example we had 3 clips on the stage and we applied on each one of them an effect.
We couldn't see the effects how it worked, because the second and third clip was underneath the first one. So, by calling this method you practically, bring the clip on which you apply the effect on top position.
If you have a similar problem you need to call setChildIndex method on the flasheff and add it to top position after you set the target on the flasheff.
e.g this.setChildIndex(flasheffInstance, this.numChildren-1)
Re: reassigning effect via flashEff2Code instance to many clips. July 07, 2010 03:01PM | Registered: 13 years ago Posts: 9 |
This piece of code i a sample the way it works for me:
import flash.display.MovieClip;
import FlashEff2Code;
import com.jumpeye.flashEff2.symbol.stripes.FESLightStripes;
import com.jumpeye.Events.FLASHEFFEvents;
var mc1:MovieClip = new Mc1();
var mc2:MovieClip = new Mc2();
var mc3:MovieClip = new Mc3();
addChild(mc1);
addChild(mc2);
addChild(mc3);
var mc_arr = [mc1,mc2,mc3];
var counter:uint = 0;
var myEffect:FlashEff2Code = new FlashEff2Code();
addChild(myEffect);
var showEffect:FESLightStripes = new FESLightStripes();
//here you should place showEffects properties for specific SHOW pattern from online panel or from FlashEff2ActionScript generator //i cut them for brevity
myEffect.showTransition = showEffect;
myEffect.target = mc1;
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_START, onTransStart);
function onTransStart(e:FLASHEFFEvents):void {
myEffect.showDelay=5;
}
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, onTransEnd);
function onTransEnd(e:FLASHEFFEvents):void {
if(counter < mc_arr.length - 1)
counter++;
else
counter = 0;
myEffect.target = mc_arr[counter];
this.setChildIndex(myEffect,this.numChildren-1)
myEffect.showTransition = showEffect;
myEffect.showAutoPlay=true;
}
//I've got three movieClips in the library which are exported for AS and their classes are Mc1 Mc2 Mc3. Of course there should be //FlashEff2Code and FESLightStripes instance in this case placed in library too.
import flash.display.MovieClip;
import FlashEff2Code;
import com.jumpeye.flashEff2.symbol.stripes.FESLightStripes;
import com.jumpeye.Events.FLASHEFFEvents;
var mc1:MovieClip = new Mc1();
var mc2:MovieClip = new Mc2();
var mc3:MovieClip = new Mc3();
addChild(mc1);
addChild(mc2);
addChild(mc3);
var mc_arr = [mc1,mc2,mc3];
var counter:uint = 0;
var myEffect:FlashEff2Code = new FlashEff2Code();
addChild(myEffect);
var showEffect:FESLightStripes = new FESLightStripes();
//here you should place showEffects properties for specific SHOW pattern from online panel or from FlashEff2ActionScript generator //i cut them for brevity
myEffect.showTransition = showEffect;
myEffect.target = mc1;
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_START, onTransStart);
function onTransStart(e:FLASHEFFEvents):void {
myEffect.showDelay=5;
}
myEffect.addEventListener(FLASHEFFEvents.TRANSITION_END, onTransEnd);
function onTransEnd(e:FLASHEFFEvents):void {
if(counter < mc_arr.length - 1)
counter++;
else
counter = 0;
myEffect.target = mc_arr[counter];
this.setChildIndex(myEffect,this.numChildren-1)
myEffect.showTransition = showEffect;
myEffect.showAutoPlay=true;
}
//I've got three movieClips in the library which are exported for AS and their classes are Mc1 Mc2 Mc3. Of course there should be //FlashEff2Code and FESLightStripes instance in this case placed in library too.
Sorry, you do not have permission to post/reply in this forum.