Flex: load extern actionscript
Feb10Difficulty: 




The cool thing about Adobe Flex is that you can run within your mxml file Actionscript.
I love standards and clean code. That’s why I wanted to know how I can run an extern Actionscript.as file.
It’s pretty easy:
1. Create a new folder in your Flex project. – I called it: includes
2. In my mxml I define the extern Actionscript:
include "../includes/scripts.as";
]]>
3. I’ll also define the action into mxml, I want it after a button click:
4. In my includes folder I create an Actionscript: scripts.as:
For example:
import mx.controls.Alert;
private var alert:Alert;
private function init():void {
var alertText:String = “Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse rutrum metus nonummy augue. In hac habitasse platea dictumst. Nulla arcu libero, nonummy non, suscipit a, mollis non, augue. Maecenas porttitor urna vel enim. Nam eget tortor. Mauris facilisis suscipit felis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin nunc turpis, venenatis non, laoreet at, fringilla nec, purus. Sed sodales. Sed turpis. Vestibulum sagittis justo id metus. Sed placerat, nibh lobortis mattis adipiscing, sapien wisi interdum arcu, nec vehicula sem tortor id nibh.”;
var alertTitle:String = “The quick brown fox jumped over the lazy dog.”;
alert = Alert.show(alertText, alertTitle);
alert.status = “I’m a status message”;
}
That made my day!
Posted in flex |actionscript, / extern actionscript, / Flex, / mxml
» 1 Comment, post your comment now. »
One Response to “Flex: load extern actionscript”
ziet er vet uit!
Comments
- Pulkit Singhal
- Neil
- mike nittmann
- geniutrixone
- Mika
- Romfrosk
- steve
- shahzad
- Maurice
- Lee
- Oskar Krawczyk