Home Tutorials Forums Articles Blogs Movies Library Employment Press

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

Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Old 11-07-2007, 03:46 PM   #1
blu3
Senior Member
 
blu3's Avatar
 
Join Date: Jun 2006
Location: Croatia
Posts: 210
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:

Code:
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:

Code:
myRepeater.currentItem
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
__________________
BLUE
blu3 is offline   Reply With Quote
Old 11-07-2007, 04:11 PM   #2
Can I
Registered User
 
Can I's Avatar
 
Join Date: Oct 2006
Location: Coventry, UK
Posts: 46
Default

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

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, 05:34 PM   #4
blu3
Senior Member
 
blu3's Avatar
 
Join Date: Jun 2006
Location: Croatia
Posts: 210
Default

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


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 12:45 PM
loader component and progress bar justix Components 0 03-23-2005 08: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 08:40 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, 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.