Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-28-2009, 06:28 PM   #11
EvLSnoopY
Freshman ActionScript Dev
 
EvLSnoopY's Avatar
 
Join Date: Jun 2009
Location: Edmond, OK
Posts: 345
Default

ActionScript Code:
var S:MouseEvent = new MouseEvent(MouseEvent.CLICK); ff(S);//does run function ff(e:MouseEvent):void{     trace("ok")     } stage.addEventListener(S.type, ff);
I know you were using that code as an example, but is there any time in a project that you would actually use that code? It seems to me like that would be quite a reduntant way of doing things.
__________________
JynxStudio
"Knowledge is power."
"Show no fear in the face of adversity."
Please use the [ as ][ /as ] tags for your code.
EvLSnoopY is offline   Reply With Quote
Old 09-28-2009, 06:35 PM   #12
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Yes I do use some of that sometimes but anyway it's just good to know we can do that. A good example could be dispatching event. You could have a method checking which event you need to dispatch and pass that to your dispatcher as in:
ActionScript Code:
dispatchEvent(getEvent());
Where the getEvent method would return the event:
ActionScript Code:
private function getEvent():Event{ //check which event you need return //whatever }
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 09-28-2009, 06:44 PM   #13
DragonflyLuis
Member
 
Join Date: Aug 2009
Location: Colima, Mexico
Posts: 86
Default maybe you need this

import flash.net.URLRequest;

add it to stop getting the URLRequest error
DragonflyLuis is offline   Reply With Quote
Old 09-28-2009, 06:46 PM   #14
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Quote:
Originally Posted by DragonflyLuis View Post
import flash.net.URLRequest;
Absolutely that's what his code needs.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 09-28-2009, 06:46 PM   #15
EvLSnoopY
Freshman ActionScript Dev
 
EvLSnoopY's Avatar
 
Join Date: Jun 2009
Location: Edmond, OK
Posts: 345
Default

Ahh...I see. Cool cool. I didn't know if the preceding code was practical or not. Thanks for the response!
__________________
JynxStudio
"Knowledge is power."
"Show no fear in the face of adversity."
Please use the [ as ][ /as ] tags for your code.
EvLSnoopY is offline   Reply With Quote
Old 09-30-2009, 03:30 PM   #16
discretion
Registered User
 
Join Date: Aug 2009
Posts: 28
Default New problems

So i managed to fix most of my problems by simplifying what I needed to do all the way down to just a few trace statements and it seems like some of my functions either aren't being called or they are not doing what I need them to do. I think its more that they are being called but what I am having them do is not actually taking place. Meaning... they are returning their strings but are not producing my trace statements. Any thoughts?

"Main Script"
ActionScript Code:
package {     import flash.events.*;     import flash.display.*;     //public class interfaceSCRIPT is an extension of a movie clip and is implementing the ITest interface     public class interfaceSCRIPT extends MovieClip implements ITest {         //creates variable var1 and provides it with the string "tracer"         var var1:String = new String("tracer");         public function interfaceSCRIPT () {             //trace statement to show this function is being called and runs testFunct() function             trace ("--");             testFunct ();         }         //function implemented by the ITest interface         public function testFunct ():String {             var1 = "trace++";             return var1;             trace (var1);         }     } }

"Interface Script"
ActionScript Code:
package {     public interface ITest {         function testFunct ():String;     } }
discretion is offline   Reply With Quote
Old 09-30-2009, 03:33 PM   #17
discretion
Registered User
 
Join Date: Aug 2009
Posts: 28
Default Nevermind

Nevermind I figured it out. I can't run a trace statement from withing the interface function because the function is returning a value and not being actually "run" like other functions. Traced the var1 from within the main script and it showed the value assigned to it from within the interface function.

Thanks for the help everyone
discretion is offline   Reply With Quote
Old 09-30-2009, 03:36 PM   #18
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

Sorry I didn't check your code before but the reason the trace wasn't working is because it was placed after the return statement which not only returns a value but also terminate the execution of the current method code.
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Old 10-06-2009, 10:52 PM   #19
discretion
Registered User
 
Join Date: Aug 2009
Posts: 28
Default

Thanks for the feedback. Now I know and will continue to execute
discretion is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:27 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.