Hey! At first: a big "thank you", I'm gonna try to get this work on monday at my office!
Well: I can't tell you exactly what I want to do, I just wanted to know how that stuff works. I already knew the creationComplete things. I wanted to know, how to use the Flash Events. Finally I have to port a running Flash application to Flex2. Because it doesn't really work (at least for me), to use the existing swf in Flex (I read from some issues with AS2 / AS3...) I try to port the entire app. Or: do you know a better method to integrate an existing flash-app into Flex2? I tried to put the entire Flash app into a swc file and use this with Flex2 but I didn't get it to work :( Perhaps somebody has some hints how to do this (but I think that's the same problem with AS2 / AS3...). PS: The Flash App is built with MX2004. Thanks, bye, Fritz --- In [email protected], Jeff Tapper <[EMAIL PROTECTED]> wrote: > > Fritz - > > this is easily enough done, but before showing you how to do that, can you > tell us why you want it in onEnterFrame? I suspect that the > creationComplete event is a more appropriate solution to what you are trying. > > Here is the code you asked for: > ShowAlert.as > ========= > package { > import mx.controls.Alert; > import mx.core.UIComponent; > import flash.events.Event; > > public class ShowAlert extends UIComponent{ > public function ShowAlert(){ > this.addEventListener("enterFrame",showAlertBox); > } > public function showAlertBox(event:Event){ > this.removeEventListener("enterFrame",showAlertBox); > mx.controls.Alert.show("frame entered"); > } > } > } > > main.mxml > ========= > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*" > > <ShowAlert /> > </mx:Application> > > If this is all you want, it can be done more simply as: > Main.mxml > ======== > <?xml version="1.0" encoding="utf-8"?> > <mx:Application > xmlns:mx="http://www.macromedia.com/2005/mxml" > creationComplete="alert.showAlert()"> > <ShowAlert2 id="alert" /> > </mx:Application> > > ShowAlert2.as > ========= > package { > import mx.controls.Alert; > public class ShowAlert2 { > public function showAlertBox(){ > mx.controls.Alert.show("drawn once"); > } > } > } > > > > > At 09:54 AM 12/16/2005, you wrote: > >Hi. > >At first: thanks for your replies, they sound quite useful. > >But: > >Could anybody of you be so kind and show me, how to write an AS3 class > >and a MXML file which does the following: > >The mxml file should be the main file. > > > >The MXML file should invoke the AS class and the AS class should show > >an alert box onEnterFrame and then delete onEnterFrame. > > > >I hope somebody can show me how this works, I can't do it :( > > > >Thx, > >bye, > >Fritz > > > > > > > > > > > >-- > >Flexcoders Mailing List > >FAQ: > ><http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt>http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > >Search Archives: > ><http://www.mail-archive.com/flexcoders%40yahoogroups.com>http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > > > > > > >SPONSORED LINKS > ><http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>Web > >site design development > ><http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>Computer > >software development > ><http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>Software > >design and development > ><http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZI36cYzBjw>Macromedia > >flex > ><http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Computer+software+development&w3=Software+design+and+development&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>Software > >development best practice > > > > > >---------- > >YAHOO! GROUPS LINKS > > > > * Visit your group > > "<http://groups.yahoo.com/group/flexcoders>flexcoders" on the web. > > * > > * To unsubscribe from this group, send an email to: > > * > > <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED] > > > > * > > * Your use of Yahoo! Groups is subject to the > > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service. > > > > > >---------- > ------------------------ Yahoo! Groups Sponsor --------------------~--> AIDS in India: A "lurking bomb." Click and help stop AIDS now. http://us.click.yahoo.com/9QUssC/lzNLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

