Hi guys, Thanks for your fast responses.
Ramon, your solution worked and I can see the values of the URL inside the onRelease function when i trace it, however a browser wont launch when i click the button. Im not sure why. Any suggestions? <<CODE>> function buildNav():Void { var dropDownValue:Number = 0; for (var i:Number = 0; i<_root.numberOfItems; i++) { //attach the nav Item trace("done iteration "+i); navContainer.attachMovie("navItem", "navItem"+i, i); trace("navItem"+i+" has been attached"); //position the nav Item navContainer["navItem"+i]._y = dropDownValue; dropDownValue += 15; navContainer["navItem"+i]._x = navContainer["navItem"+i]._x; //assign the title navContainer["navItem"+i].navItemText = _root.contentItems[i].navItemText; //var thisURL = _root.contentItems[i].jobUrl; navContainer["navItem"+i].__n = i; navContainer["navItem"+i].onRelease = function() { trace(_root.contentItems[this.__n].jobUrl); <-----------------THIS WORKS getURL(_root.contentItems[this.__n].jobUrl, "_blank"); <-----------------THIS DOESNT }; } } Cheers, Craig. On 5/23/06, Ramon Miguel M. Tayag <[EMAIL PROTECTED]> wrote:
Try tracing the _root.contentItems[1].jobUrl in the different steps of the program: when you create it, before you enter the onRelease defining part, etc. The problem must lie in referencing it. Note, however, that this code won't work (look at part 1): http://pastebin.com/732422 You'll need to save the "i" on the button itself so it can remember (look at part 2) http://pastebin.com/732422 On 5/23/06, Craig Stanford <[EMAIL PROTECTED]> wrote: > Hello Everyone, > > I am experiencing a strange issue when I am trying to do an onRelease in the > following code. All it does is cycle through the items in an XML file, then > assign the data to labels, buttons etc. Everything works fine until I try to > assign the URL. Even when I try to trace it out inside the onRelease > function it gives undefined. Is this a flash issue or is there something > here I am missing? > > Any help is much appreciated. > > <<CODE>> > > function buildNav():Void { > var dropDownValue:Number = 0; > for (var i:Number = 0; i<_root.numberOfItems; i++) { > //attach the nav Item > trace("done iteration "+i); > navContainer.attachMovie("navItem", "navItem"+i, i); > trace("navItem"+i+" has been attached"); > //position the nav Item > navContainer["navItem"+i]._y = dropDownValue; > dropDownValue += 15; > navContainer["navItem"+i]._x = navContainer["navItem"+i]._x; > //assign the title > navContainer["navItem"+i].navItemText = > _root.contentItems[i].navItemText; > //var thisURL = _root.contentItems[i].jobUrl; > navContainer["navItem"+i].onRelease = function() { > getURL(_root.contentItems[1].jobUrl, "_blank"); > trace(_root.contentItems[1].jobUrl); > }; > } > } > > Cheers, > Craig. -- Ramon Miguel M. Tayag Managing Director Quirkworks _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com