A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Access of undefined property

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    17

    Access of undefined property

    Can someone help me? I have a file that i downloaded from a previous thread. It was in Action Script 2.0, i tried to make it Action Script 3.0. I thought i did everything right. But i guess not. So i does anyone think they can tackle this? And make it work?

    Ive attached a zip folder that contains the original file and my files.

    Thanks!
    Attached Files Attached Files

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am not quite sure what you want to accomplish, but you need to extend the Cellrenderer and not the Movieclip class and then clean up:
    PHP Code:
    package 
    {
        
    import fl.controls.LabelButton;
        
    import fl.controls.listClasses.CellRenderer;
        
    import fl.controls.listClasses.ICellRenderer;
        
    import fl.controls.listClasses.ListData;
        
    import flash.display.*;

        public class 
    MyRenderer extends CellRenderer implements ICellRenderer
        
    {
            public function 
    MyRenderer ()
            {
                
    super();
            }
            
    override public function set listData (newListData:ListData):void
            
    {
                
    _listData newListData;
                
    this.width 30;
                
    // label = "Random: " + _listData.label;
                
    drawRandomColor ();
            }

            private function 
    drawRandomColor ():void
            
    {
                
    graphics.beginFill (Math.random()*0xFFFFFF);
                
    graphics.drawRect (0,0,20,20);
                
    graphics.endFill ();
            }

            
    override public function get listData ():ListData
            
    {
                return 
    _listData;
            }

            
    override public function set data (newData:Object):void
            
    {
                
    _data newData;
            }

            
    override public function get data ():Object
            
    {
                return 
    _data;
            }
        }

    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    17

    Exclamation Wait?

    Why do i have to have php. That has nothing to do with my project. What im trying to do is create a flash project with two forms that you can take and move around. Im not sure how to do it in AS3.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    This is not php. It is just a tool on Flashkit to show code. Just focus on the Flash code.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    cancerinforms code is written in Actionscript 3.
    And he showed you some things you needed to do to make it AS3 compatible.

    It just says php code because that's what the forum software supports for code highlighting, and since PHP and Actionscript 3 share some similarity many people use that option.

    As for what you want to do, I'd do something along these lines.

    Create your Components in flash, give them instance names.
    Then in Actionscript add event listeners for mouseDown, mouseUp and enterFrame.

    When downHandler is fired set a boolean var to true, when up false.
    Then in the enterFrame, if the bool is true then form pos = mouse pos.

  6. #6
    Junior Member
    Join Date
    Aug 2009
    Posts
    17

    Talking

    Well i have done the mouse up and mouse down. and they already have instance names. If someone would acually download my file and look you might understand. Its in CS4 though. Ill post another one is CS3. Its more than just all that. When you read the errors you might understand. Cuz i sure dont. As for enterFrame. When and where would i put that?
    Attached Files Attached Files

  7. #7
    I just noticed u posted another AS3 Example fla.

    I edited the one in your first post.
    Commented things out that were causing errors.

    And basically got the dragging of the two components working.

    There were a lot of errors with _parent and _root still being used. In AS3 it's parent and root, without the _. And many times you have to cast these as MovieClips, or cast them as what they are on their highest level.

    Don't worry about that enterframe thing I mentioned earlier. I see that you are using the startDrag, and StopDrag methods.

    Anyways look over the commented code and see why it was causing errors and then look at the correct version.

    -Tariq
    Attached Files Attached Files

  8. #8
    Junior Member
    Join Date
    Aug 2009
    Posts
    17
    Hey Tariq thanks soooo much. that help me out a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center