Solved

Flex 2 "Access of undefined property" Error.

Posted on 2007-04-04
3
2,951 Views
Last Modified: 2009-12-04
Flex 2 "Access of undefined property" Error.

I can't figure out why I'm getting this error...

Main app Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >

<mx:Script>
      <![CDATA[
            import dto.Example;
            
            [Bindable]
            public var tempExample:Example = new Example();
            tempExample._id = "test";
            
            
      ]]>
</mx:Script>

</mx:Application>



Class Code: (File saved in "dto" folder off application root)
package dto
{
      public class Example{
            
            public var _id:String;
            
            public function Example(){
                  
            }
            
      }
}

0
Comment
Question by:jpilz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
teddysetiawan earned 500 total points
ID: 18855531
<![CDATA[
            import dto.Example;
           
            [Bindable]
            public var tempExample:Example = new Example();
            tempExample._id = "test";   // you can't do this , as property/method must be change in function
           
           
      ]]>

---- Must understand that <![CDATA[]]>  tag is a class


so your code should be

<![CDATA[
            import dto.Example;
            import mx.controls.Alert;
           
            [Bindable]
            public var tempExample:Example = new Example();
           
            public function init():void{
                  tempExample._id="asdalsdhashdjha";
                  Alert.show(tempExample._id);
            }
                       
      ]]>


------------------------------------------------------------------------------
I change a little bit , just copy and paste the code



<?xml version="1.0" encoding="utf-8"?>
<mx:Application
      xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="absolute"
    creationComplete="init()">

<mx:Script>
      <![CDATA[
            import dto.Example;
            import mx.controls.Alert;
           
            [Bindable]
            public var tempExample:Example = new Example();
           
            public function init():void{
                  tempExample._id="TEST";
                  Alert.show(tempExample._id);
            }
           
           
      ]]>
</mx:Script>

</mx:Application>



It will pop up an Alert Message "TEST"


0
 
LVL 4

Expert Comment

by:danieldear
ID: 18918964
 tempExample.var _id = "test";
i think so
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question