Home
> FlashEff 1 (Discontinued version)
> Topic
Add flashEff to dynamically created MC with Actionscript
Posted by aigarinsh
Add flashEff to dynamically created MC with Actionscript August 09, 2008 12:11PM | Registered: 15 years ago Posts: 4 |
Hi!
Can anyone help me with this one? I have simple slide show with XML, where everything is created in lvis class. When I try to add flashEff to MC where image is already loaded it throws me this error: [FLASHEFF ERROR] You must set a non-null DisplayObject.
Main movie is completely empty with document class lvis and just flashEff and FESSquareScale in its library and the code for lvis.as is like this:
I'm kinda knew to AS3 and classes.
Can anyone help me with this one? I have simple slide show with XML, where everything is created in lvis class. When I try to add flashEff to MC where image is already loaded it throws me this error: [FLASHEFF ERROR] You must set a non-null DisplayObject.
Main movie is completely empty with document class lvis and just flashEff and FESSquareScale in its library and the code for lvis.as is like this:
package { import flash.display.*; import flash.events.*; ... public class lvis extends MovieClip { ... public var lvis1:MovieClip = new MovieClip(); ... public function lvis() { addChild(lvis1); } ... public function loadFirstTime(e:Event):void { lvis1.addChild(loader); var myEffect:FlashEff = new FlashEff(); myEffect.showTransitionName = "com.jumpeye.flashEff.symbol.squareEffect.FESSquareScale"; this.addChild(myEffect); myEffect._targetInstanceName = "lvis1"; } } }
I'm kinda knew to AS3 and classes.
Re: Add flashEff to dynamically created MC with Actionscript August 14, 2008 08:24AM | Registered: 15 years ago Posts: 22 |
aigarinsh
You are very close. You can find the example you're looking for inside the attached zip archive
This is the code you can find in class file:
You are very close. You can find the example you're looking for inside the attached zip archive
This is the code you can find in class file:
package { import flash.display.Loader; import flash.display.MovieClip; import flash.events.Event; import flash.net.URLRequest; /** * ... * @author Daniel Demian */ public class Ivis extends MovieClip { public var lvis1:MovieClip = new MovieClip(); /** * Contructor */ public function Ivis() { addChild(lvis1); loadImage(); } /** * Loads the image */ private function loadImage():void { var request:URLRequest = new URLRequest("image.jpg") var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded) loader.load(request); } /** * Image complete handler * @param evt The event object dispatched */ private function imageLoaded(evt:Event):void { this.lvis1.addChild(evt.currentTarget.loader); applyEffect(); } /** * Apply effect on the 1vis target */ private function applyEffect():void { var myEffect:FlashEff = new FlashEff(); myEffect.showTransitionName = "com.jumpeye.flashEff.symbol.squareEffect.FESSquareScale"; this.addChild(myEffect); myEffect.target = this.lvis1; } } }
Re: Add flashEff to dynamically created MC with Actionscript August 14, 2008 09:11AM | Registered: 15 years ago Posts: 4 |
Re: Add flashEff to dynamically created MC with Actionscript August 14, 2008 10:22AM | Registered: 15 years ago Posts: 22 |
Sorry, you do not have permission to post/reply in this forum.