Solved

Flex 2 "Access of undefined property" Error.

Posted on 2007-04-04
3
2,937 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

856 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