I am working on a few demos getting Flash applications running Android. I was able to download the AIR SDK and can run a simple Flash application that displayed "Hello, world!" on my Android device.
Then, to complicate the application, I created an empty text field and converted it to a movie clip and named it "text_mc". Then in the frame I set the AS to
_root.displayText();
stop();
Then I went to the Scene where execution begins and did:
#include "Demo.as"
Then I created Demo.as in the same folder as demo.fla.
var title = "Hello, world!";
function displayTitle()
{
text_mc.header_txt.text = title;
}
I try and build and receive the following error:
Scene 1, Layer 'Layer 1', Frame 1, Line 1 1093: Syntax error.
That line is #include "Demo.as"
. I pulled up some old flash applications I had worked on a while back and that's exactly how it was imported before. I tri开发者_JAVA百科ed adding a semicolon to the end, but it didn't change anything. What am I missing? How do I include an ActionScript file to execute it's functions?
AS2: #include "Demo.as"
AS3: include "Demo.as"
include behaves the same as if you copy and paste the file contents into your code. import makes a class available for use within your code.
I guess I'm behind on the times... to include external ActionScript now it appears you need to use import rather than include.
Changing the line to import Demo
resolved the error.
精彩评论