Recognize stage instance references in actionscript

I'm transitioning from Flash Pro IDE to IntelliJ (actually Astella but there's no forum for that).

In my workflow I often create movieclips in a .fla and place them on the stage from within the Flash IDE. I then name them, and can reference them by name in the class' .as script. However, when I edit the .as file in IntelliJ, it identifies these references as errors ("Unresolved variable or type <name>") because they are not declared in the script. Is there any way to get the editor to realize these are referenced in the associated .fla?

11 comments
Comment actions Permalink

Actually Astella forum exists but this one has larger audience for sure.

I'm not familiar with Flash Pro and *.fla files. Is it possible to attach minimal sample project so that we can investigate your workflow?

0
Comment actions Permalink

Alexander, I've attached a zipped file. It contains an Astella project with two files in the src folder: the StageInstance.as, which refers to a variable "MyBlueBall," and StageInstance.fla, which contains a MovieClip placed on the stage named "MyBlueBall."

Compiling within Astella results in an error: "[StageInstance (StageInstance)] Access of undefined property MyBlueBall."

Compiling within Flash results in it running correctly.



Attachment(s):
StageInstance.zip
0
Comment actions Permalink

Thank you for the sample project! Looks like using *.fla files as sources in Flex project is an incorrect approach. It doesn't seem to be related to IDE - these are constraints of Flex compiler. Hope you'll find the answer in Flash related forums.

0
Comment actions Permalink

Ok, but here's a similar problem. I declare an instance of a class, e.g. I say, "var newThing : Thing = new Thing();" and then I call a method of the thing "Thing.doMethod ()" Astella marks the "doMethod" as an error "Unresolved function or method" even though the method is a public method of the class.

0
Comment actions Permalink

you can't call non-static method using class reference

0
Comment actions Permalink

Thanks for the response.

Are you saying it's not possible, or that it shouldn't be done, or that the editor doesn't recognize it?

0
Comment actions Permalink

How is doMethod() declared?

0
Comment actions Permalink

AlexanderD wrote:

How is doMethod() declared?

public function rename (newName : String) : void {
     NameField.text = newName;
}

0
Comment actions Permalink

Instance methods are invoked via instance reference. OOP basics, lesson 1. :)

By the way I see either a very bad code style or a potential bug in this small code abstract. What is NameField? If it is a field then its name should start with lowercase. If it is a class then modification of static field via instance method is very suspicious.

0
Comment actions Permalink

AlexanderD wrote:

Instance methods are invoked via instance reference. OOP basics, lesson 1. :)

By the way I see either a very bad code style or a potential bug in this small code abstract. What is NameField? If it is a field then its name should start with lowercase. If it is a class then modification of static field via instance method is very suspicious.

NameField is an instance of a TextField. I'm in the habit of naming instances of classes with uppercase, to distinguish from non-visual things such as strings or ints. Not perfect OOP practice I know, but it works for me.

0

Please sign in to leave a comment.