This content has been marked as final. Show 8 replies
if you do include then you dont need package and clas declarations, jus create some as file name it whatevert you want and put this :
private var currentUser:User;
private var currentAccessTicket:AccessTicket;
private var services:RemoteObject;
public function Test()
services = new RemoteObject("GenericDestination");
and then use include to uncide that codeanywhere you want in mxml.
As Levancho says. If you DO want to use a class, then instantiate it first:
<Main id="main" />
then in code you can say:
The problem here, if I do that then the arrows that could expand and collapse functions will disappear.
I need to define the package and class declaration for some reasons.
I have here MXML file called index.mxml and ActionScript called Main.as
Within script tag inside index.mxml I defined the following:
public function initApplication():void
var main:Main = new Main(this);
For the custom events that index.mxml was listening (this issue has been solved, Main can listening to them because I passed application instance through Main constructor).
The problem here, I need to access some component inside index.mxml
from Main.as by the following code:
Note: component's name = resultExhibitorWrapperView
application.getChildByName("resultExhibitorWrapperView").resultExhibitorView.relationshipR esultArray = relationshipResultArray;
Note: component's id = resultExhibitorWrapperView
application.resultExhibitorWrapperView.resultExhibitorView.relationshipResultArray = relationshipResultArray;
And once I tried I got the following message:
1119: Access of possibly undefined property resultExhibitorView through a reference with static type flash.display:DisplayObject.
How can I fix that?
what data type are you using in main to store APplication refference?
looks like its not either Application or Object, it mustbe something else, and thats the problem,
either user Object (then you loose IDE autoComplete feature) or use datatype Application, or cast it to Application whenever you need to access its children
I am using Application datatype. I got that problem during the compiler time.
what s resultExhibitorView? a mxml component with id="resultExhibitorView' or action script instantiated component if so what is the modified for it? public?
Exactly: resultExhibitorView (a custom component with id = "resultExhibitorView"). I guess there is no way to deal with those components with application datatype unless I treated as index datatype.
You can explicitly type the application reference variable as "index" (an mxml file becomes a class named the same as the msml file name). then the compiler will find the public methods in it correctly.
Alternatively, you can turn off compile-time type checking, and you can type the app variable as Application.