2

I am new to flex development. Have my share of experience in asp.net though. I am looking for the equivalent of external js script files. My current situation consists of the following:

I have a lot of script code (), and I'd like to tidy it up a bit. Perhaps by putting them in separate files. Is that possible? if so how?

Thank you

1 Answer 1

3

you can use the include keyword. This allows you to split you code into smaller chunks across files.

Be aware this is different than creating a class and importing it.

include "my_file.as";

be aware if you are not using relative file locations, the include is operating system dependant. This includes windows/mac/linus directory separators.

-- extended

@DoubleThink - Your comment is rude. There is no 'ofcourse no' - Not constructive dude.

@vondip - try to think of it as cutting up the code within the script tags, rather than doing this with the mxml.

You would probably write something more along the lines of:

<fx:script>
    include 'interfaceHandlers.as';
    include 'animationFunctions.as';
    include 'externalCalls.as';
    //... etc
</script>

therefore you only have one script block in you mxml you've added to set your includes.

You'll probably discover, as you progress you'll lean towards using more classes and one controller. Bypassing the need to use many many functions and cutting up your code by using imported classes you've built to handle various small tasks. This is the more OOP way of life and it'll uber help when you debug one day.

Sign up to request clarification or add additional context in comments.

2 Comments

interesting. Can I write <fx:script> blocks inside a regular action script file?
sorry for stupid questions, still very novice to flex. Then how can I divide my fx:script to multiple files to make it more tidy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.