[flexcoders] How can I reference the particular item I am using?
Hi everyone,This post title isn't all that descriptive but I couldn't think of a better one. The question is pretty straightforward though. I think it's best explained with an example. Let's say I have an image... mx:Image source="../pictures/banner.jpg"/Now, let's say that if I click the banner, I want to do something with, say the source, like pass it to a function. I could do something like... mx:Image source="../pictures/banner.jpg" click="SomeFunction('../pictures/banner.jpg')"/BUT, I want to know if there is a way to do the same thing without hardcoding in the source again (for my application, the source is a variable, that's why...so I can't hardcode it). I'm looking for something similar to... mx:Image source="../pictures/banner.jpg" click="SomeFunction(this.source)"/ // ERROR - doesn't workIt seems like something that I should be able to do, but I just can't figure out how.Thanks in advanceCharles __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] How can I reference the particular item I am using?
try this:mx:Image source=../pictures/banner.jpg click=SomeFunction(event)/function someFunction (event:Event):void{ var refToMyComponent = event.target ;}On 6/21/06, Charles [EMAIL PROTECTED] wrote: Hi everyone,This post title isn't all that descriptive but I couldn't think of a better one. The question is pretty straightforward though. I think it's best explained with an example. Let's say I have an image... mx:Image source=../pictures/banner.jpg/Now, let's say that if I click the banner, I want to do something with, say the source, like pass it to a function. I could do something like... mx:Image source=../pictures/banner.jpg click=SomeFunction('../pictures/banner.jpg')/BUT, I want to know if there is a way to do the same thing without hardcoding in the source again (for my application, the source is a variable, that's why...so I can't hardcode it). I'm looking for something similar to... mx:Image source=../pictures/banner.jpg click=SomeFunction(this.source)/ // ERROR - doesn't workIt seems like something that I should be able to do, but I just can't figure out how. Thanks in advanceCharles __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] How can I reference the particular item I am using?
My guess would be to give the image an ID... mx:Image id="myPic"source="../pictures/banner.jpg" click="someFunction({myPic.source})" I doubt the syntax is right, but I think that's the right idea... Shan __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___ -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.2/370 - Release Date: 6/20/2006