-
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
-
Senior Member
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. -
-
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(immibgroundRect, 1, {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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|