RE: [Flashcoders] Timer object created twice in class
Could it be a mistyped i == 1 ? And for that matter: function checkPlaying(e:TimerEvent) : void if (1 == 1) { should be function checkPlaying(e:TimerEvent) : void { if (1 == 1) { Karina -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki Sent: 04 May 2010 8:25 To: Flash Coders List Subject: Re: [Flashcoders] Timer object created twice in class Before I can go any further, I saw this in your code: if (1 == 1) { ... ?!?! On Tue, May 4, 2010 at 2:58 PM, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: Here's a snippit and a timeline version of it - when I run it on the timeline, it works as expected, but when I run it within my class it acts as though there are two instances of the _timer object. On the timeline, it works as expected, tracing, 1 1 True But when I have it inside my class, it traces, 1 0 false 1 1 True What am I not seeing or understanding here? Thanks.. // Version on timeline: var _timer:Timer; function init() { _timer = new Timer(250, 0); _timer.addEventListener(TimerEvent.TIMER, checkPlaying); _timer.start(); } function checkPlaying(e:TimerEvent) : void { if (1 == 1) { e.target.stop(); trace(e.target.currentCount, _timer.currentCount); trace(e.target == _timer); } } init(); // Version in class: public function Tracker(video) { _video = video; } public function init() { _timer = new Timer(250, 0); _timer.addEventListener(TimerEvent.TIMER, checkPlaying); _timer.start(); } function checkPlaying(e:TimerEvent) : void if (1 == 1) { e.target.stop(); trace(e.target.currentCount, _timer.currentCount); trace(e.target == _timer); } } I'm instantiating it from another class like this: if (_tracker == null) { _tracker = new Tracker(_videoScreen); } _tracker.init(); _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ 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
[Flashcoders] XML Question
Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Hi, Your switch uses page_name, but your XML says pg_name. Not sure about the other question at the moment, but it looks like you are repeating your self in the switch statement - if all your pages have DETAILS, do you need to switch? I am guessing you may have pages that differ? HTH a little, Glen On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ 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] XML Question
On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. You need attention to detail with XML. Compare your switch variable with the XML.. TIA, John ___ 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] XML Question
i'd also recommend having a root node and an xml type declaration at the start a On 5 May 2010 14:05, Paul Andrews p...@ipauland.com wrote: On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. You need attention to detail with XML. Compare your switch variable with the XML.. TIA, John ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Adding MC with some frames from library
Hi I met situation with AS3 that I can not explain or even understand where I should look answer. Simple example. In library I have simple movie clip with linkage class name nav. This mc has mc2 with two frames. In frame 1- stop(). On the stage I add this nav function init():void{ var nav:Nav=new Nav(); nav.x=200; nav.y=200; addChild(nav); } init(); nav is on the stage correctly. Mc2 in frame 1. But if I use another way function init(e:Event):void{ var nav:Nav=new Nav(); nav.x=200; nav.y=200; addChild(nav); } btn.addEventListener(MouseEvent.CLICK,init); nav is on the stage but mc2 somehow stops in frame2. Please can anybody explain this situation? Thanks in advance. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] ExternalInterface broken? chrome and safari on linux...
anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
Your switch statement doesn't work because it should look like this instead: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE switch (xmldata.pa...@pg_name) { case index: pageDetails = xmlData.DETAILS.toString(); break; case contact: pageDetails = xmlData.DETAILS.toString(); break; } That said, the line: pageDetails = xmlData.DETAILS.toString(); is repeated over and over in your switch, which is pointless. Instead of a switch statement, use E4X syntax in XML to get the right data - something like this: pageDetails = xmlData.PAGE.(@pg_name == someValue).DETAILS.text(); 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) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 8:49 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] XML Question Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ 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
[Flashcoders] stopping propagation of an event
Hi list... I have a TextArea component used for inputting text. Also, the stage has a key listener where something happens if the user keys i. The issue arises when the user starts inputting text into the TextArea. If she types i, the stage event fires. I don't want that to happen if the user's focus is in the TextArea. I've tried to take the event off the button when the focus is in the TextArea, but that seems buggy. Also, I tried stopImmediatePropagation, priority and useCapture on the TextEvent, all to no avail. Can anyone offer a strategy? Thanks! - Michael M. myTextArea.addEventListener(TextEvent.TEXT_INPUT, block, true, 100); private function block(t:TextEvent):void{ if(t.text == i || t.text == I){ // gets here, but doesn't stop the i from firing the stage listener's keyboard event t.stopPropagation(); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch (xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] ExternalInterface broken? chrome and safari on linux...
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html Flash Player for Linux version 9.0.31.0 and later supports the ExternalInterface class in the following browsers: Browser Mozilla 1.7.x and later Firefox 1.5.0.7 and later SeaMonkey 1.0.5 and later _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of tom rhodes Sent: Wednesday, May 05, 2010 10:26 AM To: flashcoders Subject: [Flashcoders] ExternalInterface broken? chrome and safari on linux... anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ 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] XML Question
- Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] ExternalInterface broken? chrome and safari on linux...
Why would anyone in their right mind want to run Safari on a Linux box :'( On 05/05/2010 16:25, tom rhodes wrote: anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ 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] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:53:53 AM Subject: Re: [Flashcoders] XML Question It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. Right. That's what I said at the outset, that I knew I was doing something fundamentally wrong, but don't know how to do it correctly. Here I am with Moock trying to figure it out but I'm missing it. Could you give an example? TIA, John -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe href=mailto:jonathangh...@gmail.com;jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton ymailto=mailto:johnsingleton...@yahoo.com; href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;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] ExternalInterface broken? chrome and safari on linux...
ok, currently got probs with firefox as well on linux. the swf thinks ExternalInterface is available but nothing gets called in the JS On 5 May 2010 18:00, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html Flash Player for Linux version 9.0.31.0 and later supports the ExternalInterface class in the following browsers: Browser Mozilla 1.7.x and later Firefox 1.5.0.7 and later SeaMonkey 1.0.5 and later _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of tom rhodes Sent: Wednesday, May 05, 2010 10:26 AM To: flashcoders Subject: [Flashcoders] ExternalInterface broken? chrome and safari on linux... anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 17:30, John Singleton johnsingleton...@yahoo.com wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:53:53 AM Subject: Re: [Flashcoders] XML Question It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. Right. That's what I said at the outset, that I knew I was doing something fundamentally wrong, but don't know how to do it correctly. Here I am with Moock trying to figure it out but I'm missing it. Could you give an example? TIA, John -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe href=mailto:jonathangh...@gmail.com;jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton ymailto=mailto:johnsingleton...@yahoo.com; href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
I think you just need a root node. var xmlData:XML = new XML (rootPAGE pg_name='index'DETAILSpage/DETAILS /PAGE/root); trace(xmldata.pa...@pg_name.tostring() == index); // true var xmlData:XML = new XML (PAGE pg_name='index'DETAILSpageDETAILS /PAGE); trace(xmldata.pa...@pg_name.tostring() == index); // false _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 11:03 AM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ 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] ExternalInterface broken? chrome and safari on linux...
On 05/05/2010 17:43, tom rhodes wrote: ok, currently got probs with firefox as well on linux. the swf thinks ExternalInterface is available but nothing gets called in the JS Maybe it's really a problem with the code. The most common error is trying to call Flash functions before the swf is ready. Might that be it? Or are you just calling javascript from flash? On 5 May 2010 18:00, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html Flash Player for Linux version 9.0.31.0 and later supports the ExternalInterface class in the following browsers: Browser Mozilla 1.7.x and later Firefox 1.5.0.7 and later SeaMonkey 1.0.5 and later _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of tom rhodes Sent: Wednesday, May 05, 2010 10:26 AM To: flashcoders Subject: [Flashcoders] ExternalInterface broken? chrome and safari on linux... anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ 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 ___ 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] XML Question
I think you just need a root node. No way. Your first example traces true just because there is only one pg_name attribute. Consider this: var xmlData:XML = root PAGE pg_name='index'DETAILSpage/DETAILS/PAGE PAGE pg_name='contact'DETAILSpage/DETAILS/PAGE /root; trace(xmldata.pa...@pg_name.tostring() == index); // false because it evaluates as indexcontract -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 17:49, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: I think you just need a root node. var xmlData:XML = new XML (rootPAGE pg_name='index'DETAILSpage/DETAILS /PAGE/root); trace(xmldata.pa...@pg_name.tostring() == index); // true var xmlData:XML = new XML (PAGE pg_name='index'DETAILSpageDETAILS /PAGE); trace(xmldata.pa...@pg_name.tostring() == index); // false _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 11:03 AM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Changing display index on the stage
Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] ExternalInterface broken? chrome and safari on linux...
now i'm testign with a super simple test swf in AS2 like this... import flash.external.ExternalInterface; if(ExternalInterface.available) { statusTXT.text = External Interface is available; ExternalInterface.call(alert, Called from flash); getURL(javascript:alert('alternative JS call');); } and while both alert's fire on windows, in FF and chrome on ubuntu not even the second one goes. as far as timings go, in the actual project i call JS to set a var to say that the flash is all ready and raring to go before anything gets called in it. plus it works fine on windows in every browser i've tried... On 5 May 2010 18:59, Paul Andrews p...@ipauland.com wrote: On 05/05/2010 17:43, tom rhodes wrote: ok, currently got probs with firefox as well on linux. the swf thinks ExternalInterface is available but nothing gets called in the JS Maybe it's really a problem with the code. The most common error is trying to call Flash functions before the swf is ready. Might that be it? Or are you just calling javascript from flash? On 5 May 2010 18:00, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html Flash Player for Linux version 9.0.31.0 and later supports the ExternalInterface class in the following browsers: Browser Mozilla 1.7.x and later Firefox 1.5.0.7 and later SeaMonkey 1.0.5 and later _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of tom rhodes Sent: Wednesday, May 05, 2010 10:26 AM To: flashcoders Subject: [Flashcoders] ExternalInterface broken? chrome and safari on linux... anyone got ExternalInterface calls working in chrome/safari on linux? or know why mine might be failing? they work on everything else seemingly... tia, tom. ___ 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 ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Changing display index on the stage
Hi, //Assumes mc1 is on the stage and has linkage set to mc1 var mc2:MovieClip = new MovieClip(); addChild(mc2); addChild(mc1); hth, Bob -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, May 05, 2010 10:17 AM To: Flash Coders List Subject: [Flashcoders] Changing display index on the stage Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) ___ 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] Changing display index on the stage
Look into getChildByName to get a reference to the MC on the stage, ie getChildByName('instanceName').x. _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, May 05, 2010 12:17 PM To: Flash Coders List Subject: [Flashcoders] Changing display index on the stage Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) ___ 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
[Flashcoders] Question about Flash Builder 4
Quick question... my document class is in FB4 and it's linked with my FLA in Flash CS5. Every time I save the document class, it publishes the FLA in the IDE. Is there a way to turn that off (even temporarily)? Eric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
Now, how can I build a switch statement to determine which page? Did you read my reply? I didn't see a response to it. 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) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 1:28 PM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ 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] Changing display index on the stage
My interpretation of the question was we want the depth of the added object to be lower than the object that is already on the stage. So I don't think the x coordinate is the answer. So the first answer where Robert re-addChilds mc1 technically works in the simple situation, but if you have other objects on the stage, you'll start to mess up the depth order of your stage objects. I would recommend using addChildAt and setting the depth of mc2 to that of mc1's: this.addChildAt(mc2, this.getChildIndex(mc1)); That way, everything in the stack from mc1 + up is promoted instead of mc1 being popped to the top of the stack. -jonathan On Wed, May 5, 2010 at 1:56 PM, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: Look into getChildByName to get a reference to the MC on the stage, ie getChildByName('instanceName').x. _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, May 05, 2010 12:17 PM To: Flash Coders List Subject: [Flashcoders] Changing display index on the stage Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) ___ 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 -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
If I understood you correctly, you want to filter the XML data according to a variable passed to the SWF. If so you'd do something like: var pageDetails:String = xmlData.PAGE.(@pg_name == loaderInfo.parameters.page).DETAILS; // page is the name of the var passed to the SWF here But I strongly recommend you to have a look at SWFAddress, which is absolutely indispensable framework if you are creating a site driven by dynamic data ;) Kenneth Kawamoto http://www.materiaprima.co.uk/ John Singleton wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing display index on the stage
Thank you very much! That is exactly what I need. 2010/5/5 jonathan howe jonathangh...@gmail.com: My interpretation of the question was we want the depth of the added object to be lower than the object that is already on the stage. So I don't think the x coordinate is the answer. So the first answer where Robert re-addChilds mc1 technically works in the simple situation, but if you have other objects on the stage, you'll start to mess up the depth order of your stage objects. I would recommend using addChildAt and setting the depth of mc2 to that of mc1's: this.addChildAt(mc2, this.getChildIndex(mc1)); That way, everything in the stack from mc1 + up is promoted instead of mc1 being popped to the top of the stack. -jonathan On Wed, May 5, 2010 at 1:56 PM, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: Look into getChildByName to get a reference to the MC on the stage, ie getChildByName('instanceName').x. _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto: flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, May 05, 2010 12:17 PM To: Flash Coders List Subject: [Flashcoders] Changing display index on the stage Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) ___ 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 -- -jonathan howe ___ 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] Question about Flash Builder 4
Eric E. Dolecki wrote: Quick question... my document class is in FB4 and it's linked with my FLA in Flash CS5. Every time I save the document class, it publishes the FLA in the IDE. Is there a way to turn that off (even temporarily)? Eric Turn off automatic building. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing display index on the stage
natalia Vikhtinskaya wrote: Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) My recommendation: create a holder mc on the timeline and add stuff to the holder instead. The holder can be given a proper layer in the IDE and the code will be simple. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question about Flash Builder 4
Ok, I'll bite - where is that setting? Poking around in prefs right now. On Wed, May 5, 2010 at 3:16 PM, Henrik Andersson he...@henke37.cjb.netwrote: Eric E. Dolecki wrote: Quick question... my document class is in FB4 and it's linked with my FLA in Flash CS5. Every time I save the document class, it publishes the FLA in the IDE. Is there a way to turn that off (even temporarily)? Eric Turn off automatic building. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question about Flash Builder 4
Ok, I'll bite - where is that setting? Poking around in prefs right now. Project ... Build Automatically. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question about Flash Builder 4
Found it Under Build - sorry for the noise :) On Wed, May 5, 2010 at 3:35 PM, Eric E. Dolecki edole...@gmail.com wrote: Ok, I'll bite - where is that setting? Poking around in prefs right now. On Wed, May 5, 2010 at 3:16 PM, Henrik Andersson he...@henke37.cjb.netwrote: Eric E. Dolecki wrote: Quick question... my document class is in FB4 and it's linked with my FLA in Flash CS5. Every time I save the document class, it publishes the FLA in the IDE. Is there a way to turn that off (even temporarily)? Eric Turn off automatic building. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing display index on the stage
Please explain. Do you mean to create empty holder manually? How to add stuff to it? My first try was to add mc from the library with linkage class name. This is simple navigation bar with back next arrows. So in the library I have mc nav. Nav has two mcs (arrows). Each mc has two frames inside. Everything would be fine if I just add this in the beginning. But I add it after event. And after that everything becames crazy. This two-frame mc stops on frame 2. Here is fla http://www.mightybook.com/test/example.zip I could not solve this problem and decided that only what I can to add it on the stage. So solution was found with guru help. But I would want to understand why all this crazy things happened. It is really hard when simple things from AS2 are completly difficult in AS3. 2010/5/5 Henrik Andersson he...@henke37.cjb.net: natalia Vikhtinskaya wrote: Hi Is it possible to have mc1 manually placed on stage be over mc2 created dynamically mc2=new MovieClip(); addChild(mc2) My recommendation: create a holder mc on the timeline and add stuff to the holder instead. The holder can be given a proper layer in the IDE and the code will be simple. ___ 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] Changing display index on the stage
natalia Vikhtinskaya wrote: Please explain. Do you mean to create empty holder manually? How to add stuff to it? Create a new empty movielclip symbol. Do not give it any class. Do not put any content in it. Now place an instance of this symbol on the timeline. Give this instance an instance name. Then use the instance name as a property to access the mc when adding: holder_mc.addChild(stuff); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing display index on the stage
I would like to point out that use of empty clips is a polarizing technique in terms of public opinion. Some people find that they make projects difficult to maintain. -jonathan On Wed, May 5, 2010 at 4:12 PM, Henrik Andersson he...@henke37.cjb.netwrote: natalia Vikhtinskaya wrote: Please explain. Do you mean to create empty holder manually? How to add stuff to it? Create a new empty movielclip symbol. Do not give it any class. Do not put any content in it. Now place an instance of this symbol on the timeline. Give this instance an instance name. Then use the instance name as a property to access the mc when adding: holder_mc.addChild(stuff); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Question about Flash Builder 4
Go me! What about just saying nav.btnBack.gotoAndStop(1); nav.btnNext.gotoAndStop(1); _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 – Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki Sent: Wednesday, May 05, 2010 2:40 PM To: Flash Coders List Subject: Re: [Flashcoders] Question about Flash Builder 4 Found it Under Build - sorry for the noise :) On Wed, May 5, 2010 at 3:35 PM, Eric E. Dolecki edole...@gmail.com wrote: Ok, I'll bite - where is that setting? Poking around in prefs right now. On Wed, May 5, 2010 at 3:16 PM, Henrik Andersson he...@henke37.cjb.netwrote: Eric E. Dolecki wrote: Quick question... my document class is in FB4 and it's linked with my FLA in Flash CS5. Every time I save the document class, it publishes the FLA in the IDE. Is there a way to turn that off (even temporarily)? Eric Turn off automatic building. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development -- http://ericd.net Interactive design and development ___ 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
[Flashcoders] Question about MouseEvent.ROLL_OVER and ROLL_OUT
I have an AS3 fla file with a mc and stop() on frame 1 and different content on additional frames. When the swf is launched, I would like to have a MouseEvent.ROLL_OVER with a function to gotoAnd Play frame 2. Also I would like to have a MouseEvent.ROLL_OUT with a function to gotoAndSop on frame 1. I have added a mc the size of my file and used it as a button. I can get the ROLL_OVER to work, but not the ROLL_OUT. I hope this is not to vague. Can anyone help. Don Talcott 316 Greenwood Ave Decatur, GA 30030 404 538-1642 dtalc...@mindspring.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question about MouseEvent.ROLL_OVER and ROLL_OUT
Please post your code if you can. It may be a problem with the way you have written it. Karl On May 5, 2010, at 4:35 PM, Donald Talcott wrote: I have an AS3 fla file with a mc and stop() on frame 1 and different content on additional frames. When the swf is launched, I would like to have a MouseEvent.ROLL_OVER with a function to gotoAnd Play frame 2. Also I would like to have a MouseEvent.ROLL_OUT with a function to gotoAndSop on frame 1. I have added a mc the size of my file and used it as a button. I can get the ROLL_OVER to work, but not the ROLL_OUT. I hope this is not to vague. Can anyone help. Don Talcott 316 Greenwood Ave Decatur, GA 30030 404 538-1642 dtalc...@mindspring.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Question about MouseEvent.ROLL_OVER and ROLL_OUT
Instead of using a MC the size of the stage, you may want to try listening like - this.root.addEventListener(MouseEvent.ROLL_OVER, overHandler) and this.stage.addEventListener(Event.MOUSE_LEAVE, offHandler); _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Donald Talcott Sent: Wednesday, May 05, 2010 4:36 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Question about MouseEvent.ROLL_OVER and ROLL_OUT I have an AS3 fla file with a mc and stop() on frame 1 and different content on additional frames. When the swf is launched, I would like to have a MouseEvent.ROLL_OVER with a function to gotoAnd Play frame 2. Also I would like to have a MouseEvent.ROLL_OUT with a function to gotoAndSop on frame 1. I have added a mc the size of my file and used it as a button. I can get the ROLL_OVER to work, but not the ROLL_OUT. I hope this is not to vague. Can anyone help. Don Talcott 316 Greenwood Ave Decatur, GA 30030 404 538-1642 dtalc...@mindspring.com ___ 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] Question about MouseEvent.ROLL_OVER and ROLL_OUT
My file has two scenes. See code below. Originally the Mouse Events were MouseEvent.CLICK and they worked fine. Scene 1 Frame 1 stop(); playScene2_btn.addEventListener(MouseEvent.MOUSE_OVER, playScene2); function playScene2(evt:Event) { gotoAndPlay(1, Scene 2); } Scene 2 Frame 1 gotoScene1_btn.addEventListener(MouseEvent.CLICK, gotoScene1); function gotoScene1(evt:Event) { gotoAndStop(1, Scene 1); } On May 5, 2010, at 5:44 PM, Karl DeSaulniers wrote: Please post your code if you can. It may be a problem with the way you have written it. Karl On May 5, 2010, at 4:35 PM, Donald Talcott wrote: I have an AS3 fla file with a mc and stop() on frame 1 and different content on additional frames. When the swf is launched, I would like to have a MouseEvent.ROLL_OVER with a function to gotoAnd Play frame 2. Also I would like to have a MouseEvent.ROLL_OUT with a function to gotoAndSop on frame 1. I have added a mc the size of my file and used it as a button. I can get the ROLL_OVER to work, but not the ROLL_OUT. I hope this is not to vague. Can anyone help. Don Talcott 316 Greenwood Ave Decatur, GA 30030 404 538-1642 dtalc...@mindspring.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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
[Flashcoders] SIP library in as3 for player 10.1
Anyone know of a working SIP library in AS3 for player 10.1? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Producing a random list with no repeats
I am working in ActionScript 2. I want to create a quiz in which 10 questions are randomly selected from a block of 40 questions. I found the following code, but I can't work out how to stop it doubling up the questions. function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; } for (var i = 0; i 10; i++) { var n:Number = randRange(1, 40) trace(n); } When I run this it outputs a list of numbers like 40 13 17 12 27 12 3 17 9 15 which means some questions (in this case 17 and 12) will appear twice in my quiz. Bearing in mind that I am a bit of an ActionScript dummy, can anybody suggest a way to modify the above script to prevent the same number being generated more than once. This message is for the named persons use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Producing a random list with no repeats
It's probably best just to create an Array or Vector containing numbers 1 to 40. (Vectors are only available in AS3, not sure about Array). Shuffle the array, then choose the first 10 elements. A reasonably effective way to shuffle an array is to step through the array, and for each element swap it with some other randomly selected element. Another approach is to start with an array whose elements contain numbers 1 through 40. Randomly select one of the 40 elements, record its value, and remove it from the array. Now you have 39 elements. Randomly select one of the 39 elements, record its value, and remove it from the array. Continue in this fashion until you've selected 10 elements. The worst approach is to repeatedly generate random numbers in the range 1 through 40, and add the number your list of questions only if it's not already on the list. The reason this approach is bad is that the execution time is unpredictable - you could be 'rolling the dice' hundreds of times and always getting numbers that are already on your list. On 2010-05-06 , at 08:45 , Alan Neilsen wrote: I am working in ActionScript 2. I want to create a quiz in which 10 questions are randomly selected from a block of 40 questions. I found the following code, but I can't work out how to stop it doubling up the questions. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Producing a random list with no repeats
Hi Allen, Just a thought, but maybe have the quiz numbers set in an array that the var n:Number is retrieved and have the min and max that the random code calls match the amount of items in the array. After selecting a question, remove it from the array, thus the array length (max) reduces and the random code still works, but the previous questions are no longer in the array to choose from. var numArray:Array = new Array(); numArray = [40, 20, 35, 4, 5, 9]; var currentNum:Number = null; function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random(max, min)); return randomNum; } for (var i = 0; i numArray.length; i++) { var n:Number = randRange(0, numArray.length); currentNum = numArray[n]; numArray = numArray.splice(n); trace(incrament number: +i); trace(currentNum: +currentNum); trace(numArray: +numArray); } This was off the top of the head, so you will need to test it. HTH, Karl On May 5, 2010, at 7:45 PM, Alan Neilsen wrote: I am working in ActionScript 2. I want to create a quiz in which 10 questions are randomly selected from a block of 40 questions. I found the following code, but I can't work out how to stop it doubling up the questions. function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; } for (var i = 0; i 10; i++) { var n:Number = randRange(1, 40) trace(n); } When I run this it outputs a list of numbers like 40 13 17 12 27 12 3 17 9 15 which means some questions (in this case 17 and 12) will appear twice in my quiz. Bearing in mind that I am a bit of an ActionScript dummy, can anybody suggest a way to modify the above script to prevent the same number being generated more than once. This message is for the named persons use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. ## ### This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal ## ### ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Producing a random list with no repeats
A simple way: Put all the candidate numbers in a list (in this case, 1 to 40). Then pick randomly from that array, one at the time, and make sure you remove that number from the candidates list, so you can't have duplicates. In code (untested): function getRandomList():Array { var min:Number = 1; var max:Number = 40; var numItems:Number = 10; var candidates:Array = []; // fill up the candidates list with the eligible numbers for(var i:Number = min; i = max; i++) { candidates.push(i); } var list:Array = []; var idx:Number = 0; var selectedNumber:Number = 0; for(i = 0; i numItems; i++) { // get a number from the candidates list, randomly. Add it to the result and remove it from the candidates list (using splice) idx = Math.floor(Math.random() * candidates.length); selectedNumber = candidates.splice(idx,1)[0]; list.push(selectedNumber); } return list; } Cheers Juan Pablo Califano 2010/5/5 Alan Neilsen aneil...@gotafe.vic.edu.au I am working in ActionScript 2. I want to create a quiz in which 10 questions are randomly selected from a block of 40 questions. I found the following code, but I can't work out how to stop it doubling up the questions. function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; } for (var i = 0; i 10; i++) { var n:Number = randRange(1, 40) trace(n); } When I run this it outputs a list of numbers like 40 13 17 12 27 12 3 17 9 15 which means some questions (in this case 17 and 12) will appear twice in my quiz. Bearing in mind that I am a bit of an ActionScript dummy, can anybody suggest a way to modify the above script to prevent the same number being generated more than once. This message is for the named person’s use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or; lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of any such entity. # This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal # ___ 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