RE: [Flashcoders] Q:Tracing out objects in an array
Hi, I'm populating an array with objects. When I trace out the array I get ==[object Object] Whats the best way to trace out the contents of the objects once they're in the array? There are different ways It could be as simple as trace( myArray.toSource( 0 ) ); for more info see: http://www.burrrn.com/projects/core2.html http://www.burrrn.com/documentation/core2/files/buRRRn/core2/Array-es.html#A rray.toSource http://live.burrrn.com/browser/ECMA-262/core2/branches/core2_v1.0.x/src/buRR Rn/core2/Array.es#L710 HTH zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Q:Tracing out objects in an array
toSource toschmorze. Meaning ? Array.prototype.trace = function() { var retString = Array contents:+newline; for (var i = 0; ithis.length; i++) { retString+=i+: ; if (typeof (this[i]) == object) { for(var prop in this[i]){ retString+=prop+ = +this[i][prop]+newline; } retString+=newline; }else{ retString+=this[i]; retString+=newline; } } trace(retString); }; //usage arr = [lol, {horse:yes,donkey:no}]; arr.trace(); Just an example. Here another one arr = [ humm,[I,{wonder:[where,you,learned,{to:indent,so:[badly]}]}] ]; trace Array contents: 0: humm 1: trace = [type Function] 1 = [object Object] 0 = I Now let's try core2 #include core2_v1.0.1_AS.as1 trace( arr.toSource( 0 ) ); trace [ humm, [ I, { wonder: [ where, you, learned, { to:indent, so: [ badly ] } ] } ] ] You could also try that for some more fun _global.walk = {the:{path:{of:{the:{object:{}}; trace( GetObjectPath( walk.the.path.of.the.object ) ); trace walk.the.path.of.the.object trace( walk: + walk.toSource( 1, ** ) ); trace walk: { the: **{ **path: { of: **{ **the: { object: **{ **__path__:walk.the.path.of.the.object **} } **} } **} } trace( String.format( {0,40:_}, GetObjectPath( walk ) ) ); trace( String.format( {0,40:_}, GetObjectPath( walk.the ) ) ); trace( String.format( {0,40:_}, GetObjectPath( walk.the.path ) ) ); trace( String.format( {0,40:_}, GetObjectPath( walk.the.path.of ) ) ); trace( String.format( {0,40:_}, GetObjectPath( walk.the.path.of.the ) ) ); trace( String.format( {0,40:_}, GetObjectPath( walk.the.path.of.the.object ) ) ); trace walk walk.the ___walk.the.path walk.the.path.of walk.the.path.of.the _walk.the.path.of.the.object Do you understand *now* the difference between a library and a single function ? zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Obfuscation
if anyone has any further coherent information or personal experience with obfuscating by hand (ie not using someone else's software)... i would be more then happy to hear from you. once i actually achieve any results i will report back. i'm benchmarking against asv and sothink 2005 build 5.whatever. One thing that people don't consider is that You don't need to obfuscate if people can not access the SWF In the first place 1) use SSL + prevent caching in the HTTP header - no SWF in the browser cache or 2) instead of pointing to foobar.swf in the Object/Embed tag point to getBinary.php /getBinary.asp / whatever + prevent caching in the HTTP header - no SWF in the browser cache It's complicated to put in place, but the result is No SWF in the browser cache to decompile 2) off course is still not 100% safe against people being able to detect a SWF stream with a HTTP sniffer but the solution 1) well.. almost unbeatable zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Obfuscation
Neither of your 'solutions' is even remotely unbeatable. I can get around both of them with the wget command-line tool, which is a standard install on most flavours of linux. There are others that do the same thing, and any download accelerator program for Windows will also be able to download the file. I can block wget with just JavaScript ;) http://www.gnu.org/software/wget/faq.html#3.6 Wget doesn't feature JavaScript support and is not capable of performing recursive retrieval of URLs included in JavaScript code. In fact, it is impossible to extract URLs from JavaScript by merely parsing it. Web clients need to actually execute it, and Wget can't do that since it's not a GUI browser. Obfuscation is the only way to protect your code, and even then I wouldn't consider it 'almost unbeatable'. I still think obfuscation is not the only way... zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Obfuscation
protecting something is all about making hard to access so imho anything that can make a SWF hard to get is good so to make a big answer to everyone point by point Gregory wrote: Yes, using some server-side solution can beat 90% of amateur thieves. But, as mentioned above, it's only about web page. As obfuscation can beat 90% of amateur joe-user-using-a-decompiler But not the 10% rest of user who gonna either be motivated or skilled enougth to unobfuscate the code... steve wrote: Fair enough, but then you also block all your regular visitors who have JavaScript disabled from accessing your SWF file. For me someone who does not want to execute JavaScript also does not want to execute plugins and how many users gonna do that ? like 0,001% ? Anyway, ultimately the swf file will be loaded from somewhere (via physical file or script) and I can just point wget at that file instead. That can be obfuscated too Nathan wrote: Proxy sniffers are also easy to come by, easy to use, and give you the option to save any of the files locally. Yes, for you Not everybody find a sniffer that easy to use, or even would have the idea to use one just because they didn't even know that something like that exists Dave wrote: While this is true for wget, there are engines that will execute Javascript to extract URLs, then fetch those URLs. Texis' Webinator does this. It's also relatively easy to do this using Windows Script functionality. I ended up writing scripts for exactly this purpose - to fetch Javascript URLs. Yes ok, but are you considering yourself as a lambda user ? I think not :) In addition, as others have mentioned, it's very easy to capture anything through a proxy. SSL doesn't prevent this, either. Yes I know that, others people on this list know that, But are lambda users know that or have the skill to do that ? Protecting something is all about numbers a) foobar.swf no protection, no obfuscation, nothing accessible in the browser cache b) how many % of users will just know that they can decompile the SWF with some tools as ASV or others ? c) how many % users will want so bad the source code of the SWF to actually buy the tool to decompile it ? d) add obfuscation how many % of users will be motivated and skilled enougth to reverse the obfuscation ? e) add SSL + prevent SWF caching how many % users will be motivated and skilled enougth to set up and use a proxy and/or a HTTP sniffer ? etc. the more you add, the more you reduce the % of users who will actually go all the trouble to get the SWF, decompile it, etc. you will never obtain 100% code protection but if the goal is to protect the code with tricks any tricks are good, even the dumb one as renaming extensions *.swf to *.gif and honestly I was just mentioning another trick, no more zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Obfuscation
I'm not familiar with the phrase lambda user, so I can only presume it means a non-technical user. Yes indeed But are those the people who you're concerned about? I think it's worthwhile to mention that you might have different goals and expectations with regard to obfuscation than others might. My point was simply that you can't guarantee that your Flash code can't be reverse-engineered. I don't think I said something different with you will never obtain 100% code protection Here for example a goal you can not reach with obfuscation: - you have an online game in flash Goal: you want to avoid to have your SWF copied all around on different site Here the obfuscation will be not really usefull If you're willing to accept that limitation, you might want to implement all the things you mentioned. But that's still a very big limitation. There are certain things that, for security reasons, you simply wouldn't want to do within your Flash code for this reason - shopping cart engine functionality comes to mind. You wouldn't want your server-side application to blindly accept inputs from Flash for obvious reasons. Humm but this is a different thing You got the security of the source code, the SWF, etc... And You got the security of your application And this, the SWF being accessible or not, Being decompiled or not You can secure it using data encryption Dumb exemple: User login on his shopping cart The flash can have a MD5 Function to hash its password before sending it to the server etc. an external attacker can access as much as he want the MD5 hash function code, this will not break the security of the hash. The weakness in a hash function is the hash function algorithm itself, Not the fact that you can access its implementation in code. ( and yes I know MD5 is broken, and few others too, cf http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html ) zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Obfuscation
Personaly I think that if someone can bypass the obfuscation, (not jump tricks but *real* obfuscation by variable renaming/hashing - see http://tech.motion-twin.com/obfu ) then there is no need for additional protections because the user is motivated enough to bypass them as well. Yes but who knows in which order the user gonna try to bypass the protection(s) ? I think that you need to protect from two things : a) internal attacks, by obfuscating the SWF b) external attacks, by obfuscating the protocol This is not *real* security - it should just be called tricks to get rid of people without enough free time or technical background. Yep And to get back on topic here a little list of papers for these kind of tricks - JAurora http://wwwhome.cs.utwente.nl/~oord/ see the paper Stealthy obfuscation techniques misleading the pirates - Gleb's Naumovich's publications http://cis.poly.edu/gnaumovi/publications.html some interesting papers as Obfuscation of Design Intent in Object-Oriented Applications Preventing Piracy, Reverse Engineering, and Tampering - Christian Collberg, Clark Thomborson, Douglas Low http://www.cs.arizona.edu/~collberg/Research/Publications/CollbergThomborson Low98a/ Manufacturing Cheap, Resilient, and Stealthy Opaque Constructs zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Job Opportunity in Madrid (Spain)
...Flash Developer... You should have experience in advanced ActionScript programming, ... Design skills are not necessary. The candidate only will work in Flash and ActionScript developement. Please include personal, artistic work - ... Boolean logic error ! Salary range: from 21.000 to 24.000 euros yearly, this can vary based on candidate skills. Immediate incorporation. Resistance is futile :D zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: Duplicating an object without pointing to originalone
Rajat Paharia [EMAIL PROTECTED] wrote: I use this function (think I got it from Darron Schall's blog) to do a deep copy. I had the same experience as Jesse with mx.utils.ObjectCopy not working correctly... ok ... and ? either the mx.utils.ObjectCopy or the function you pasted CopyObject have nothing to do with how the copy method is implemented in core2 | http://www.burrrn.com/projects/core2.html in core2, polymorphism is used the 2 function you talk about are put-all-in-one-function and not polymorphic at all zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Duplicating an object without pointing to original one
Hi, How do you duplicate an object {bool:true, val:5} in another variable without pointing to the original one, and without having to create a constructor. In Director, there's a duplicate() method in Lingo. Is there an equivalent way to do this in Flash? Something like this, but which would actually work: var h = {a:true}; var g = h; trace(h.a); // true g.a = false; trace(h.a); // false, but want to be true, so it's separate from g object. I recently released a library which add this functionality of deep copy to all core objects You can download it here http://www.burrrn.com/projects/core2.html your small exemple will turn like that: var h = { a:true }; var g = h.copy(); trace( h.a ); //true g.a = false; trace( h.a ); //true zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Independent Date sorting algorithm
Hi, I wrote a portable date sorting algorithm, I thought it might be of interest to my peers since I've only seen date sorting implementations for data grids. //the following sorts an array of Date objects: function sortDateArray(a:Array, j:Boolean) { var b=['getYear','getMonth','getDate','getTime'],c=a.length,d=b.length,e = -1,f,g,h,i; while(++ec){ i = c-e-1; for(g=-1;++gc-e;) for(f=-1;++fd;){ h=[a[i][b[f]](),a[g][b[f]]()]; if(h[0]!=h[1]) if(h[0]h[1]) i = g; else break; else continue; } a.push(a.splice(i, 1)[0]); } if(j)a.reverse(); } [snip] Please feel free to mangle, Without wanting to mangle too much But the language already provide a sort function for arrays that you could reuse also the valueOf() method of the Date object could simplify a lot the comparison of values list = [ new Date( 1901, 1, 1), new Date(), new Date(2003,1,5), new Date(2005,3,5) ]; function sortDateArray2( a, b ) { a = a.valueOf(); b = b.valueOf(); if( a b ) { return 1; } else if( a == b ) { return 0 } return -1; } list.sort( sortDateArray2 ); trace( list.join( \n ) ); Fri Feb 1 00:00:00 UTC+0100 1901 Wed Feb 5 00:00:00 UTC+0100 2003 Tue Apr 5 00:00:00 UTC+0200 2005 Wed Jan 11 03:07:31 UTC+0100 2006 zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] universal toString() function
I'm quite sure that this must be around somewhere, but this time I didn't have any luck searching the archives... What I'm looking for is similar to a deep-copy/clone method (e.g. Arul/Tatsuo http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2004- March/106149.htm l) but instead of getting a clone of the object in return, I'd like to get a String representation of the object. Example of the desired functionality: o = {a:1, b:2, c:{c1:['a','b','c'], c2:true}}; var s:String = universalToString(o); trace(s); Output: {a:1, b:2, c:{c1:['a','b','c'], c2:true}} In my case the object will not contain any methods, just (deeply nested) 'vanilla' Objects, Arrays, Strings, Numbers and Booleans. Thanks for any pointers! In the core2 library you have toSource() / clone() and copy() methods Implemented for all the core objects, and more :) http://www.buRRRn.com/projects/core2.html seeing your notation you look for something working with AS2 core2 for AS2 is released Monday so not that much time to wait :) zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] FP6 can't tell between undefined null?
Can anyone confirm whether the flash 6 player can't differentiatate between a function that returns null and on which returns undefined? Is there a difference on the bytecode level? Humm first you could provide the function or at least a cutdown version of it and/or Try to use identity eguality trace( foobar() === undefined ); trace( foobar() === null ); zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Singleton in AS3
Have anyone got ideas how to implement Singleton pattern in AS3 best? Constructor in AS3 can only be public or internal, which is not private anyway. .. Well, internal should be enough to implement a Singleton Just have a public const in the package initialized with an internal class of the package Something like that myTest/MySingleton.as - package myTest { public const MySingleton:Singleton = new Singleton(); } - myTest/Singleton.as - Package myTest { //default to internal, can only be accessed inside the package class Singleton { //be sure to let the constructor internal function Singleton() { //... } //be sure to have your methods/properties/etc. public //so it can be accessed outside of the package public function someMethod():String { //... } } } - And after well import myTest.MySingleton; MySingleton.someMethod() etc. I don't see the need of a private constructors at all And furthermore private constructors imho would cause more problems than solutions What people oversee is that we are in ECMAScript, A Singleton in this context should just be an object That you can not copy and/or inherit in another prototype So a public read-only object. Here having an internal class inside a package prevent to instanciate this class outside of the package the public const force to have only one global access point to the instancied object So where is the problem ? Not having private constructors is not a bug, It's using a private constructor to implement singleton which is imho a bug/hack from AS2 times. http://www.mozilla.org/js/language/es4/core/definitions.html private - Makes the definition visible only in the enclosing class's private namespace so following the standard if you got a private constructor you just CAN NOT instanciate at all the class anywhere else than inside the class ! private constructors just does not make sens. zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Singleton in AS3
They do. With internal access modifier you're still able to create an instance of class directly. Not outside of the package, or if you have a code exemple That show that behaviour I would be interested to see it. zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Re: Newbie AS3 question
No need to get hyper about this. The matter stays that this used to be essential in AS1, thus probably why people still like to implicate him in their code. But I agree that putting this in an AS2 Class should be used only when necessary. You do know that it (this.) is being added for you at compile time in AS2, right? Who cares? All that means is that there is no semantic difference between the two. There is a difference for AS3 ! (and this is the correct behaviour) http://livedocs.macromedia.com/labs/1/flex/langref/statements.html#this To call a function defined in a dynamic class, you must use this to invoke the function in the proper scope zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] flash linux
just a quick test under vmware: ubuntu 4.10: firefox 1.04: w/o image : WORKS w image : CRASH i wonder why you cannot for the sake reproduce this. i really wonder. ... files: http://onupdate.de/ should crash OSX-browsers (at least 10.4) too. I'm just saying if you want improvement in this situation That you should take the time to provide any necessary informations to the people concerned the most by this crash and who can help you solve it really contact Macromedia, explain them the crash you're experiencing and provide them link, source code, fla, as, whatever is necessary for them to help you solve those crash zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] using prototypes -bad or good?
What is really the opinion on using prototypes now when as2 is being used? Prototypes can be used, but should it be used? Why it should not be used ? what valid reason ? I got a friend who like doing prototypes and then making an Extension of it. So in the fla-file you can #include prototypes.as I don't really like the thought of using prototypes nowadays (liked it when only as1 was the option) Well then don't use them if you don't like them And I really don't like extensions that much either. I rather see a portability in where you got as-classed instead of extensions and so on. I do must admit that I use lacos tween, and that is for now both of and prototype and an extension -which then is an #include lmc_tween.as What do you think? I think that people do not understand is that when some people talk about prototype-based programming they are talking about delegation mechanisms, prototype explicit or implicit cloning, traits, dynamic programming, closures, etc. all these are prototype-based language features, and it's far away from class-based languages paradigm all what people are seeing is wooh it's use the keyword prototype in it or wouh it's use the keyword class in it and when they're talking about prototype is bad I believe they just don't know what they're talking about ECMAScript whatever flavour is NOT Java or C# AS3 is a prototype-based language even if people can only see the class keyword, under the hood it uses prototype features Adding members to build-ins or other objects prototype in AS1, Or using AS3 classes, these are just 2 different styles of programming an ECMAScript based language. And don't take my words for that, read the AS3 documentation, Read the ECMAScript 4 proposal, do some search on google about Prototype-base object-based languages Read it yourself and make your own opinion zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Learn AS2 or AS3?
- you do not have a timeline in AS3+flex2 Just to avoid confusion AS3 still fully supports the timeline, and if you load clips with frames that were compiled in Authoring you can still use goto, stop and all other timeline methods, properties and events. It's Flex which avoids the timeline, but this was the case even when Flex compiled AS2 code. The next authoring which will have AS3 support will still have the same timeline as before (or better :) ). Yes but in term of logic from a programmer point of view You do not need to understand the timeline concept to build a web application Which is also good imho Right now, a C#/Java programmer willing to code AS2 would had to understand the timeline concept as soon as he want to code over a GUI people coming from AS2 can sure still reuse their knowledge of the timeline concept, and this can even give them some more depth understanding of how the things work under the hood but if you look just at the logic, AS3+Flex2 do not need a timeline, and this influence a lot of things, especially building visual component It had been years that I waited the way things are done now in Flex2 But well I could even go in more details just comparing how AS2 use import (as it was a simpe #include) and how AS3 import Work totally differently, even if the syntax is exactly the same I can only tell to people thinking that AS2 is not different than AS3 To go read the doc http://labs.macromedia.com/wiki/index.php/Flex:Release_Notes take prog_actionscript3.pdf read it, and compare to how things are done in AS2 zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] flash linux
How about reporting reproducible steps of the bug here and someone will get it to the engineers to look at? If its a crashing bug, like you have said, and it is reproducible, then please post it up. Otherwise, like Stan said, this indeed comes across like a rant. didn't you read the whole thread ? i posted those steps, no ? No offense too But the steps you had provided are no use to do a debug or a test This as a dev on any app would be classified As NEED MORE INFO NOT REPRODUCIBLE Or NOT A BUG If you can not provide a crashing file either in source code Or FLA source or well defined steps to reproduce the bugs AND the machine/os/system configuration where those crashing occurs This crashing will never be solved Dev can not solve bugs they can not tests and/or reproduce That's all, not even need to complain or rant zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Is there a Flashcoders newsgroup?
Hi, Is it possible to get this mailing list through a newsgroup or is there another newsgroup that is predominately used by this community? There has been a flascodeurs newsgroup inspired in the name and spirit from this list created some years ago, but the language there is french only and the volume is much much lower off course :) I can let the URL if some French speaking people are interested. But for accessing this list trough newsgroup you should go to gmane.org news.gmane.org the group this list is mapped to: gmane.comp.web.flashcoders.devel you should probably not be able to access very old archives of the list, but for daily use it's like any regular newsgroup zwetan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders