Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
Old 11-07-2007, 04:46 PM   #1
Senior Member
blu3's Avatar
Join Date: Jun 2006
Location: Croatia
Posts: 212
Default How to assign id to component using ActionScript

For example, i would like to create a Repeater component with id 'myRepeater' using AS only. I tried with:

var rep:Repeater = new Repeater();
rep.id = "myRepeater";
And code compiles without error, but how can i later on in my code use that id, for example if i would like use the following somewhere in as code:

Then i get an error. How can i assign an id to component so that i could use that id later on in my code for defininig component properties etc.?

thanks in advance
blu3 is offline   Reply With Quote
Old 11-07-2007, 05:11 PM   #2
Can I
Registered User
Can I's Avatar
Join Date: Oct 2006
Location: Coventry, UK
Posts: 46

var myRepeater : Repeater = new Repeater();
Can I is offline   Reply With Quote
Old 11-07-2007, 05:56 PM   #3
dr_zeus's Avatar
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999

To further clarify what Can I said, an id in MXML is just the variable name that is used in the ActionScript class that gets generated. There's no special property you need to set. You simply need to make your Repeater into member variable of your class.
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Old 11-07-2007, 06:34 PM   #4
Senior Member
blu3's Avatar
Join Date: Jun 2006
Location: Croatia
Posts: 212

That makes sense Thank you dr_zeus for explanation
blu3 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a New Instance of a "playPauseButton" Component via ActionScript overjoyed Components 1 07-17-2007 10:17 PM
loading order of layers/frames and its effect on actionscript arianhojat ActionScript 2.0 3 09-25-2006 10:55 PM
Adding MenuBar component to library using Actionscript? shassouneh Components 1 11-27-2005 01:45 PM
loader component and progress bar justix Components 0 03-23-2005 09:19 AM
executing actionscript commands from an xml file in TextArea component livingeachday Components 1 04-21-2004 05:36 AM

All times are GMT. The time now is 01:51 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.