Re: [Flashcoders] addEventListener Problem
2010/3/1 Beatrix Krümmer-Frau birik...@hotmail.de Did you check the spelling? Thank you all. Yes, yesterday's lesson was brought to me by the letter 'N' lol. Today's lesson is different. Here's my code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, navToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); Navigate.to(test.html); } The above code works fine, but it's only a baby-step toward what I need. I'm confused how to change test.html into a dynamic url that depends on which iteration of the displayObject is created in DisplayPicLoaded. I believe I'm supposed to use e.currentTarget.??? and that's where I'm lost. Of course, e.currentTarget refers to container, not displayObject. Perhaps I could add an URL element to container in DisplayPicLoaded, then reference it in navToURL. Please advise. TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
Hi Susan, In DisplayPicLoaded you add displayObject as a child of container. So in navToURL you can reference it as e.currentTarget.displayObject HTH Willem van den Goorbergh On 2-mrt-2010, at 13:59, Susan Day wrote: 2010/3/1 Beatrix Krümmer-Frau birik...@hotmail.de Did you check the spelling? Thank you all. Yes, yesterday's lesson was brought to me by the letter 'N' lol. Today's lesson is different. Here's my code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, navToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); Navigate.to(test.html); } The above code works fine, but it's only a baby-step toward what I need. I'm confused how to change test.html into a dynamic url that depends on which iteration of the displayObject is created in DisplayPicLoaded. I believe I'm supposed to use e.currentTarget.??? and that's where I'm lost. Of course, e.currentTarget refers to container, not displayObject. Perhaps I could add an URL element to container in DisplayPicLoaded, then reference it in navToURL. Please advise. TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is a Dutch, Utrecht-based map and chart design company. Willem van den Goorbergh can be contacted by telephone: (+31) 30-2719512 or cell phone: (+31)6-26372378 or by fax: (+31)302719687 snail mail: Hooghiemstraplein 89 3514 AX UTRECHT Visit our website at: http://www.geografiek.nl =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
On Tue, Mar 2, 2010 at 9:15 AM, Geografiek geograf...@geografiek.nl wrote: Hi Susan, In DisplayPicLoaded you add displayObject as a child of container. So in navToURL you can reference it as e.currentTarget.displayObject Half-way there. I now have this code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.url = myURLs[countRounds]; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, navToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); Navigate.to(e.currentTarget.displayObject.url); } This throws an error 1119 on this line: displayObject.url = myURLs[countRounds]; How do I attach that url? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
Hi Susan, Didn't you attach that url in DisplayPicLoaded in the line displayObject.url = myURLs[countRounds];? Error 1119 has to do with referring to a non-existent property. Do you know which? Tracing is your friend here I would say. To be honest I don't know if the Navigate.to line is correct AS3. HTH Willem On 2-mrt-2010, at 14:28, Susan Day wrote: On Tue, Mar 2, 2010 at 9:15 AM, Geografiek geograf...@geografiek.nl wrote: Hi Susan, In DisplayPicLoaded you add displayObject as a child of container. So in navToURL you can reference it as e.currentTarget.displayObject Half-way there. I now have this code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.url = myURLs[countRounds]; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, navToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); Navigate.to(e.currentTarget.displayObject.url); } This throws an error 1119 on this line: displayObject.url = myURLs[countRounds]; How do I attach that url? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
On Tue, Mar 2, 2010 at 9:47 AM, Geografiek geograf...@geografiek.nl wrote: Hi Susan, Didn't you attach that url in DisplayPicLoaded in the line displayObject.url = myURLs[countRounds];? No. I attached jpgs. Error 1119 has to do with referring to a non-existent property. Do you know which? Yes. url. Tracing is your friend here I would say. Trace what? It breaks on the line with the url, as I stated previously (in last email). I put a trace just below that line that didn't. To be honest I don't know if the Navigate.to line is correct AS3. It calls a function that I've already successfully tested. TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
On Tue, Mar 2, 2010 at 9:58 AM, Susan Day suzieprogram...@gmail.com wrote: On Tue, Mar 2, 2010 at 9:47 AM, Geografiek geograf...@geografiek.nlwrote: Hi Susan, Didn't you attach that url in DisplayPicLoaded in the line displayObject.url = myURLs[countRounds];? No. I attached jpgs. Error 1119 has to do with referring to a non-existent property. Do you know which? Yes. url. Tracing is your friend here I would say. Trace what? It breaks on the line with the url, as I stated previously (in last email). I put a trace just below that line that didn't. To be honest I don't know if the Navigate.to line is correct AS3. It calls a function that I've already successfully tested. OK. Got it: function DisplayPicLoaded(evt:Event):void { var container:MovieClip = new MovieClip(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); container.text = myURLs[countRounds]; addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, navToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); Navigate.to(e.currentTarget.text); } I had to convert my container into an mc and then add a text property. Couldn't do it with a sprite. Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] addEventListener Problem
1120: Access to undefined property NavToURL Today's show was brought to you by the capital letter N vs. the lower-case letter n. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] addEventListener Problem
You made a typo: container.addEventListener(MouseEvent.CLICK, NavToURL); must be: container.addEventListener(MouseEvent.CLICK, navToURL); //lowercase nav -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Susan Day Sent: maandag 1 maart 2010 19:50 To: Flash Coders List Subject: [Flashcoders] addEventListener Problem Hi; I have the following code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, NavToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); trace(e.currentTarget); trace('hi'); } It throws the following error: 1120: Access to undefined property NavToURL Why? What do? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.733 / Virus Database: 271.1.1/2716 - Release Date: 03/01/10 08:34:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
Flash is case-sensitive. Looks like your NavToURL in your addEventListener call should really be navToURL --T On Mon, Mar 1, 2010 at 10:50 AM, Susan Day suzieprogram...@gmail.comwrote: Hi; I have the following code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, NavToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); trace(e.currentTarget); trace('hi'); } It throws the following error: 1120: Access to undefined property NavToURL Why? What do? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
Did you check the spelling? 1120: Access to undefined property NavToURL - navToURL() Susan Day schrieb: Hi; I have the following code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, NavToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); trace(e.currentTarget); trace('hi'); } It throws the following error: 1120: Access to undefined property NavToURL Why? What do? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] addEventListener Problem
Change your function to this: function navToURL(e:Event):void { trace(e.currentTarget); trace('hi'); } --Original Message-- From: Susan Day Sender: flashcoders-boun...@chattyfig.figleaf.com To: Flash Coders List ReplyTo: Flash Coders List Subject: [Flashcoders] addEventListener Problem Sent: Mar 1, 2010 12:50 PM Hi; I have the following code: function DisplayPicLoaded(evt:Event):void { var container:Sprite = new Sprite(); var myXArray:Array = new Array(10,176,342,508,674,840); var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = myXArray[countRounds]; displayObject.y = 10; displayObject.filters = [createBevel()]; container.addChild(displayObject); addChild(container); navPics.push(displayObject); container.addEventListener(MouseEvent.CLICK, NavToURL); if (countRounds 5) { countRounds++; init(); } } function navToURL(e:Event):void { e.currentTarget.removeEventListener(MouseEvent.CLICK, navToURL); trace(e.currentTarget); trace('hi'); } It throws the following error: 1120: Access to undefined property NavToURL Why? What do? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Nathan Mynarcik Interactive Web Developer nat...@mynarcik.com 254.749.2525 www.mynarcik.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders