Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-17-2008, 09:07 PM   #1
markww
Registered User
 
Join Date: Nov 2008
Posts: 1
Default Where do I hook up my as3 file?

Hi,

I need a quick bit of help in getting going -

I just got FlexBuilder3 - where can i hook up an as3 file to it? I mean for example I have the following mxml file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	 backgroundGradientColors="[0xFFFFFF,0xAAAAAA]"
	 horizontalAlign="left"
	 verticalGap="15" horizontalGap="15" >
	<mx:HBox width="100%">
		<mx:Label text="My pathetic project:"/>
		<mx:TextInput/>
		<mx:Button label="Wow"/>
	</mx:HBox>
	
</mx:Application>
that's great and all, but I want some "main()" function in a separate as3 file where I can maintain state variables, and get going with using as3 to interact with the visual elements. I figured out how to do that for flash cs3 but not flex. All the different names are beginning to give me a headache.

Anyway any info would be great,

Thanks
markww is offline   Reply With Quote
Old 11-18-2008, 12:23 AM   #2
drkstr
Flexpert
 
drkstr's Avatar
 
Join Date: Sep 2006
Location: Seattle, WA: USA
Posts: 1,587
Default

Code:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 creationComplete="onCreationComplete();">

<mx:Script>
<![CDATA[

//this is so much easier to read then keeping it in a seperate file
private function onCreationComplete(): void {
  //start doing stuff
}
]]>
</mx:Script>

</mx:Application>
But you can also

Code:
<mx:Script source="script_file.as" />
I used to do it this way but opening two different files to look at code for the same class started to become annoying. I suggest keeping it in a Script block with your mxml, but that's just a personal preference.


Best Regards,
~Aaron
drkstr 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
as2 external swf into as3 file in3eez ActionScript 3.0 1 11-16-2008 10:08 AM
Possible to mix AS3 and AS2 in same file? asf8 ActionScript 3.0 9 05-30-2008 04:47 AM
Flash to PHP & PHP to Flash awdio ActionScript 2.0 2 11-08-2006 04:09 PM
how to open pdf file from projector file in acrobat reader sohailfx ActionScript 2.0 2 06-24-2005 05:54 PM


All times are GMT. The time now is 06:01 PM.

///
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.