RE: [Flashcoders] Array Madness - test yourself
Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ 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] Array Madness - test yourself
Judah, You probably need to also to provide a bit more info about the class because you must be doing something odd if you are only able to use a static array, unless your function is static as well, and that then leads into a whole bunch of questions about what your function is doing and how it is called and whether other functions are accessing the static arrays as well. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ 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] Array Madness - test yourself
Of cos array.length isnt really read only :-) I would suggest you post the whole function that you are using to do this as the lines of code people have suggested are correct and do work so the problem is not those lines of codes but something else and its difficult to figure this out in isolation. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Edgar Sent: Sunday, November 20, 2005 10:12 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Array Madness - test yourself Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ 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] Array Madness - test yourself
Why wouldn't you use splice(0)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Winterhalder Sent: Sunday, November 20, 2005 12:16 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself On 11/21/05, JesterXL [EMAIL PROTECTED] wrote: Better yet, why not just: myArray = []; done? usually that's what i do, but other references to the array still point to the old one, so it only works if you know for sure what references it. mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ 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] Array Madness - test yourself
The problem with this code is that the thing you are checking (array.length) is also what your are decrementing (by poping) and when combined with an incremental counter it wont work. ie. Loop0 i=0 length=2 Loop1 i=1 length=1(cos weve pop'd one of the array) Loop2 nevers happens as ilength is not true In this particular situation actually the easiest solution is to use Array.splice(0) which will clear the array in one command. But if you need to do processing on each loop then use a while loop var i=errors.length while(-1--i){ errors.pop() } Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 11:48 AM To: Flashcoders mailing list Subject: [Flashcoders] Array Madness - test yourself I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ 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] Help For Custom Components
Hmm, We bought AS2Doc a year ago, its good, probably still the best around(due to lack of any real competition) but... the bad news is AS2Doc development was abandoned in March and now there is no support whatsoever or bug fixes or new releases coming ever... There are a number of bugs, like some Interface classes get skipped, the PanelActions generate junk at times, and some essential features missing like no way to document events and of course once AS3 is here there wil be no way forward. It still might be worth buying but anyone doing so needs to do it with there eyes wide open. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of JOR Sent: Thursday, November 03, 2005 5:29 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Help For Custom Components Gregory_GOusable wrote: In MX 2004, you can write the help in form of HTML files (number of files) instead of reference tag in customactions. Then, add the tag for each html file to your .mxi like that: file source=_your_path_/file_name.html destination=$flash/HelpPanel/Help/_your_folder_ / See Extending Flash Help Panel Content article in Flash Documentation on MM site. Also, I'd recommend just download any component (for Flash MX 2004) and look through it's content, mxi etc. I just bought AS2DOC and it's awesome at creating Flash documentation files. I just ran it on a couple of packages I had recently written with JavaDoc style commenting and in a matter of seconds it created detailed help docs and an mxi file for me. I packaged the mxi file into an mxp and installed it into Flash. After looking through the docs I see I left some comments out so I'm going to use it as a reference to where to go back to my classes and add more information to fill out the pages more. Pricey but great product. Highly recommended. Unfortunatley their free trial version does not do Flash help files. JOR ___ === James O'Reilly === === SynergyMedia, Inc. === www.synergymedia.net ___ 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] Undefined and null in Flex2
Thanks spike for taking the time to reply but... Calling it legacy seems to contradict the current AS3 docs.. For example I think it is getStyle that is documented to return undefined if the style property doesn't not exist, it then goes on to say that the undefined it returns is NOT the same as null (undefined!=null). So I take from that that undefined far from being legacy is alive and well and activley used by MM in AS3... Of course could be then docs are wrong or will change. I note the comment about how it only applies to Object though and understand how when assigned the value will be coerced, thanks. It seemed to me that the docs were effectively setting a recommended practice that for generic getAnyProperty type of functions they should return undefined for undefined values rather than as at present return null(because currently undefined==null). I am somewhat confused now if MM regard undefined as legacy i.e. deprecated, should we being returning undefined or null. Also given that undefined!=null makes me wonder.. if(!x){...}else{} Does this work differently in AS3 dependent on whether x is undefined or null or does AS3 require explicit check for nullness if(x!=null) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Spike Sent: Friday, October 21, 2005 5:42 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] Undefined and null in Flex2 Hi Robert, Gordon Smith from Macromedia posted this to another list a while ago. I am reproducing it with his permission. Hopefully it will clarify things a bit: Note, that this applies only to AS 3, not to AS 2 *** 'undefined' is basically legacy baggage in AS3 that must remain for ECMA-262 compatibility. Type Object is the ONLY type that can store the value undefined. It can also store the value null... it can store anything! Some but not all other classes can store null: A derived class like Button can store null but not undefined. String and Array can store null but not undefined. Number can store NaN but it can't store undefined or null. int and uint can't store NaN, undefined, or null; they only store integers like 23. Boolean can't store undefined or null; it only stores true and false. Since Object is the only type that can store undefined, if you try to set a var of another type to undefined, it will be coerced into something different. For example, setting a Number to undefined will coerce it to NaN. - Gordon * Spike On 10/21/05, Robert Edgar [EMAIL PROTECTED] wrote: AFAIK null and undefined are the same thing in F7/8 and can be used interchangeably Conceptually however we tend to think of 'undefined' and 'defined but has a null value' as two different things. From what I have read in the Flex2 documentation undefined and null are no longer the same thing and null means 'defined but has a null value'. Can someone confirm that is correct. Thanks Rob ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Stephen Milligan Do you do the Badger? http://www.yellowbadger.com Do you cfeclipse? http://www.cfeclipse.org ___ 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] Undefined and null in Flex2
Mike, Thanks... I should have checked the FAQ..RTFM Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Chambers Sent: Friday, October 21, 2005 4:45 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Undefined and null in Flex2 What is the difference between null and undefined? http://labs.macromedia.com/wiki/index.php/ActionScript_3:resources:FAQ#What_ is_the_difference_between_null_and_undefined.3F -- In AS3, an undeclared var or property has a value of undefined. A declared var or property which has not been assigned a value has a default value of null. -- This is an alpha, so there are probably still some inconsistencies in the docs and APIs. mike chambers [EMAIL PROTECTED] Robert Edgar wrote: Thanks spike for taking the time to reply but... Calling it legacy seems to contradict the current AS3 docs.. For example I think it is getStyle that is documented to return undefined if the style property doesn't not exist, it then goes on to say that the undefined it returns is NOT the same as null (undefined!=null). So I take from that that undefined far from being legacy is alive and well and activley used by MM in AS3... Of course could be then docs are wrong or will change. I note the comment about how it only applies to Object though and understand how when assigned the value will be coerced, thanks. It seemed to me that the docs were effectively setting a recommended practice that for generic getAnyProperty type of functions they should return undefined for undefined values rather than as at present return null(because currently undefined==null). I am somewhat confused now if MM regard undefined as legacy i.e. deprecated, should we being returning undefined or null. Also given that undefined!=null makes me wonder.. if(!x){...}else{} Does this work differently in AS3 dependent on whether x is undefined or null or does AS3 require explicit check for nullness if(x!=null) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Spike Sent: Friday, October 21, 2005 5:42 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] Undefined and null in Flex2 Hi Robert, Gordon Smith from Macromedia posted this to another list a while ago. I am reproducing it with his permission. Hopefully it will clarify things a bit: Note, that this applies only to AS 3, not to AS 2 *** 'undefined' is basically legacy baggage in AS3 that must remain for ECMA-262 compatibility. Type Object is the ONLY type that can store the value undefined. It can also store the value null... it can store anything! Some but not all other classes can store null: A derived class like Button can store null but not undefined. String and Array can store null but not undefined. Number can store NaN but it can't store undefined or null. int and uint can't store NaN, undefined, or null; they only store integers like 23. Boolean can't store undefined or null; it only stores true and false. Since Object is the only type that can store undefined, if you try to set a var of another type to undefined, it will be coerced into something different. For example, setting a Number to undefined will coerce it to NaN. - Gordon * Spike On 10/21/05, Robert Edgar [EMAIL PROTECTED] wrote: AFAIK null and undefined are the same thing in F7/8 and can be used interchangeably Conceptually however we tend to think of 'undefined' and 'defined but has a null value' as two different things. From what I have read in the Flex2 documentation undefined and null are no longer the same thing and null means 'defined but has a null value'. Can someone confirm that is correct. Thanks Rob ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Stephen Milligan Do you do the Badger? http://www.yellowbadger.com Do you cfeclipse? http://www.cfeclipse.org ___ 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] Macromedia unveiling Flex 2andFlash9:communicationor cacophony ?
Just like Flash 8 feature requires Flash 8 Pro IDE Well thats wrong for a start... I can have 8 features even without any IDE, the feature are in the player, and as long as I can compile with MTASC I can have 8 features. The analogy is way off base. At least I never saw signs of this from Macromedia. Well did you see any signs it wasn't locked either? Or you just don't know either way? Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stan Vassilev Sent: Wednesday, October 19, 2005 1:16 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] Macromedia unveiling Flex 2andFlash9:communicationor cacophony ? It requires the enterprise services in the scope of the Flex product line. Just like Flash 8 feature requires Flash 8 Pro IDE in the scope of the Flash Authoring product line. It's not *LOCKED* to the flex enterprise services. At least I never saw signs of this from Macromedia. Actually if enough people jump for it we might even get AMF specs who knows ? Did you wishlist them about it? Regards, Stan Vassilev -- Well, paraphrasing from the manual. AMF requires flex enterprise services. I have read the docs for this section pretty thoroughly for this section and it definitely says this. Now, obviously, the old AMF client side code can be ported to AS3, but MM has no intent of making it easy or giving it away. They make absolutely clear in the doc that AMF requires flex enterprise services. Regards Hank. ___ 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