A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flex: access of undefined property

  1. #1
    Senior Member
    Join Date
    Mar 2001
    Location
    Breda, The Netherlands
    Posts
    522

    Flex: access of undefined property

    Hi all,

    I suppose I'm overlooking something very basic, but I can't get something very simple to work.
    I try, for example, to access a Graphic from the script block in Flex like this:
    immibgroundRect.alpha = 0.5;
    The graphic is like this:
    PHP Code:
        <s:Graphic id="immi" toolTip="{'immigratie: '}{Number(data.immi)*10000}">
            <
    s:Rect id="immibgroundRect" 
                    
    width="{Number(data.immi)*9}" height="26" 
                    
    x="{Number(data.pop)*9}" y="0">
                <
    s:fill>
                    <
    s:BitmapFill source="@Embed('../assets/man-in.png')" fillMode="repeat"/>
                </
    s:fill>            
            </
    s:Rect>
        </
    s:Graphic
    The names match and both highlight grey when I select them yet I get the error:
    1120: Access of undefined property immibgroundRect.

    What am I missing here? Thanks very much in advance for your help.
    // Kind regards, Danielle.
    // specs: Flash CS5.5 | Flash Builder 4.6 | win xp pro

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    When are you calling the id? May be the Rect is not yet created.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member
    Join Date
    Mar 2001
    Location
    Breda, The Netherlands
    Posts
    522
    Hi cancerinform, you are right, as ever
    I've added a creationComplete event and put the everything in a handler like this:
    PHP Code:
    protected function immi_creationCompleteHandler(event:FlexEvent):void
                
    {
                    
    TweenLite.to(immibgroundRect1, {x:"-100"});
                } 
    Now it works, thanks for your advice.
    // Kind regards, Danielle.
    // specs: Flash CS5.5 | Flash Builder 4.6 | win xp pro

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