;

PDA

Click to See Complete Forum and Search --> : [F9/AS3] Discoveries and discussions


SaphuA
08-01-2006, 07:21 AM
Have I missed the other F9/AS3 threads, or aren't there as many as I'd think there are?

Anywayz; I'm now installing the F9/AS3 alpha test version, and I was wondering who else did this?

What's your people first opinion on F9 and AS3? What have you already tried to get familiair with them?

I'll be back when I'm done playing ;)

~Sph

Fall_X
08-01-2006, 08:22 AM
I'm very fond of AS3/Flash 9. I really dread going back to F8 to finish some of my other projects :)

Some cool things :

- reparenting movieclips (which also means you can load them from an external swf's library and move them anywhere)
- the Dictionary class
- the URLLoader class (no longer limited to url-encoded style text documents)
- the ByteArray class
- zipping and unzipping!
- ...

SaphuA
08-01-2006, 11:24 AM
Those features sound good alright :) I guess I'll get to learn them over time...

Well, I just installed F9, and the interface is (almost) exactly the same as F8's. Not sure if that's a good thing though.

Although, I'd have no idea where to start now. Haven't yet looked into AS3, so little spare time :(

Edit: Figured it out...

Just another thing I'm wondering about; when should you place code on the TimeLine? Or should you always use a 'Document Class'? And how do you contact variables placed on the TimeLine?

Fall_X
08-01-2006, 12:03 PM
the interface is (almost) exactly the same as F8's. Not sure if that's a good thing though.That's because it's an alpha release. It's basically just Flash 8 with AS3 support. Other changes will be there in the final release.

As for the speed increase, keep in mind that it's only AS that's faster - the rendering-engine didn't improve that much as far as I know. Well, using the new Sprite class would be a bit faster than movieclips, but I'm not sure how much.

ozmic66
08-01-2006, 03:58 PM
if you're going to code a lot, use flex builder 2
It makes oo coding so much easier and lets you avoid making a lot of stupid errors

Pugger
08-02-2006, 01:06 AM
Just another thing I'm wondering about; when should you place code on the TimeLine? Or should you always use a 'Document Class'? And how do you contact variables placed on the TimeLine?
Always use a document class. From now on you should keep your code separate from you fla file, so always in external AS files when coding in AS3.

AS3 is way better than AS2 for a coder. But for a graphics person, maybe not.

Either way I've been very pleased, and then some more, by AS3.

EDIT: Probably already know, so for those who don't, heres a nice page for all AS3 needs: http://labs.adobe.com/wiki/index.php/ActionScript_3

SaphuA
08-02-2006, 06:54 AM
Thanks for the info :)

And now I'm wondering; why Flex 2? I've heard several rumours of it, but what makes it so great? Since Flash 9 is out, shouldn't we be using that instead of Flash 9?

Or is Flex 2 more aimed at coders (as in, no real drawing interface etc.)?

~Sph

Fall_X
08-02-2006, 06:57 AM
Indeed, Flex 2 is more aimed for coders, but more specifically RIA developers (rich internet applications), and it has a lot of components for this purpose. That doesn't mean you couldn't do games with it just as well, but I personally prefer sticking to F9 for now. The results should be the same.
Note : I don't have any experience with Flex at all, so I could be wrong.

UnknownGuy
08-02-2006, 02:32 PM
This should help clear things up:

http://www.gskinner.com/blog/archives/2006/07/flex_2_from_a_f.html

You see, Flex is like ground beef, Flash is like the whole darn cow. While it's completely possible to make a hamburger (form app) with the cow, it's going to take a lot more work than if you just started with the ground beef. Try making a nice sirloin steak or some cheese with the ground beef though. Sure you could force the ground beef to look, and maybe even taste kinda like cheese, but it would be a messy hack. Flash gives you the power to do a lot more things, but you have to do them from scratch.

walnoot
08-03-2006, 07:11 PM
the sound has improved tons. See andre-michelles mod-player in his experiments. Now you can make real driving sounds!

Kianis
08-03-2006, 07:15 PM
Has anyone tried out if Duff's device (http://en.wikipedia.org/wiki/Duff's_device) works in AS3?

Fall_X
08-03-2006, 08:45 PM
the sound has improved tons. See andre-michelles mod-player in his experiments. Now you can make real driving sounds!
Well, it's not actually flash's sound-handling that has improved, it is the fact that you can actually make your own swf in-memory by using a bytearray. So if you make an swf with a sound in it, you can play it back. It's a very cool trick, but a bit of a work-around - although it seems to be pretty processor-friendly. It would be a lot cooler if we could do this directly instead of like this.
It would be cool if someone made an open source mod-player like this though, which we could all use in our projects. I'd definately check it out. (would be even cooler if flash supported midi and mod files natively, off course).

walnoot
08-04-2006, 05:16 AM
Ah, I see. Allthough too advanced for me, people should check this out:
http://blog.davr.org/2006/04/21/dynamic-sound-in-85
http://www.flashcodersbrighton.org/wordpress/?cat=3

Fall_X
08-04-2006, 07:32 AM
Just a minor detail, but DisplayObject.alpha is now a value between 0 and 1, as opposed to the old MovieClip._alpha which had to be between 0 and 100. Just thought I'd mention it, as it could be confusing to some.

Fall_X
08-04-2006, 09:37 AM
Some things I really wish they will add in the release version :

- The ability to specify an "extends"-property for a library item when it's using an auto-generated class. That way, you could have a number of movieclips (or sprites or whatever) that all share the same code, without having to write a class for them.
- The ability to load any kind of file in the library, for byteArray-manipulation (not sure if that would be supported by the player though). One application would be to add a MOD-file, and play that back (with André Michelle's technique). Otherwise, you have to either use external files, or convert it to an array or something (which takes a bit more space).


Now, who do I have to sleep with to make this happen? :)

tonypa
08-04-2006, 10:06 AM
Here is little experiment with ByteArray and loadbytes.

Lets say you have declared function and you have declared variable:
function addNumbers(a:int, b:int){
return a+b;
}
var testing=100;


Now anyone with swf decompiler can see those from your swf. However, you can use bytearray to hide all the code:

var loadData:String="46575309180400007800055F00000FA000000C010044110800 00004302FFFFFFBF150B00000001005363656E6520310000BF 14A9030000000000000010002E00000000272954696D656C69 6E65305F313135666236323431663866633934643938333263 323631313238643633650003696E740774657374696E670E61 64644672616D655363726970740974656D702E617324322168 7474703A2F2F61646F62652E636F6D2F4153332F323030362F 6275696C74696E0B61646F62652E7574696C7313666C617368 2E6163636573736962696C6974790D666C6173682E64697370 6C61790C666C6173682E6572726F72730C666C6173682E6576 656E74730E666C6173682E65787465726E616C0D666C617368 2E66696C746572730A666C6173682E67656F6D0B666C617368 2E6D6564696109666C6173682E6E65740E666C6173682E7072 696E74696E670C666C6173682E73797374656D0A666C617368 2E7465787408666C6173682E75690B666C6173682E7574696C 7309666C6173682E786D6C17666C6173682E646973706C6179 3A4D6F766965436C697014666C6173682E646973706C61793A 53707269746524666C6173682E646973706C61793A44697370 6C61794F626A656374436F6E7461696E65721F666C6173682E 646973706C61793A496E7465726163746976654F626A656374 1B666C6173682E646973706C61793A446973706C61794F626A 6563741C666C6173682E6576656E74733A4576656E74446973 70617463686572064F626A656374066672616D65310A616464 4E756D62657273094D6F766965436C69700F4576656E744469 73706174636865720D446973706C61794F626A65637411496E 7465726163746976654F626A65637416446973706C61794F62 6A656374436F6E7461696E6572065370726974651F05011602 05061702080716081609160A160B160C160D160E160F161016 1116121613161416151616161718011A011A181A191A1A1A1B 1A1C1A1D1A1E021E0102030405060708090A0B0C0D0E0F1011 12131415161718191A1B1C1D1E0F070203070204090501091F 0107022007041F07020107082107021E070A22070823070824 07082507082605000002000200010102000000020000000200 00000200000107080816000303020000000005010001060100 0200000104010704010005000101090A03D030470000010203 0A0B06D030D1D2A04800000202010A0B09D0305E0224646802 4700000303010A0B12D030D049005D0324005D046604460302 29470000040201010937D03065005D096609305D0A660A305D 0B660B305D0C660C305D0D660D305D0E660E305D086608305D 08660858001D1D1D1D1D1D1D68074700003F132E0000000100 000054696D656C696E65305F31313566623632343166386663 3934643938333263323631313238643633650040000000";
var data1:Array=loadData.split("");
var data2:Array=[];
for (var i : int = 0; i < data1.length; i +=2)
{
data2.push("0x"+data1 [i]+data1[i+1]);
}
bytes = new ByteArray ();
for (var j : int = 0; j < data2.length; j ++)
{
bytes [j] = data2[j];
}
ldr = new Loader ();
ldr.contentLoaderInfo.addEventListener(Event.COMPL ETE, completeHandler);
ldr.loadBytes (bytes);
function completeHandler(e:Event):void {
trace(ldr.content.addNumbers(4,5));
trace(ldr.content.testing);
}


Note: there are no spaces in the string, forum creates those, when copying the code into Flash9 all spaces must be removed, sorry about that. If needed I will attach the code in as file.

The huge string loadData contains full swf file in byte form. After its loaded the function and variable can be accessed:

trace(ldr.content.addNumbers(4,5));
trace(ldr.content.testing);

This example should trace 9 and 100. Anyone decompiling the file can only see that string, not the function or variable.

I am pretty sure the conversion from string into byte array could be done some faster and better way, but I didnt manage to figure out it yet so the string is first split into array by each character and then turned into "0xFF" form.

Fall_X
08-04-2006, 10:42 AM
Now anyone with swf decompiler can see those from your swf.True, but at the time being, I don't think there are any as3/f9 decompilers...
This example should trace 9 and 100. Anyone decompiling the file can only see that string, not the function or variable.Also true, but if they're a bit smart, they can turn the string into an swf and decompile that too. It's another layer of difficulty, and you could xor everything to hide it even more (which still isn't secure since the key would be in the swf as well).

Edit : nice little experiment though :)

tonypa
08-04-2006, 12:21 PM
if they're a bit smart, they can turn the string into an swf and decompile that too. It's another layer of difficulty, and you could xor everything to hide it even more (which still isn't secure since the key would be in the swf as well).

Absolutely, nothing is completely 100% secure. But most Flash games are not hacked by Flash experts, the hackers use compilers (mostly hacked versions) which allow changing the strings, bitmaps and code pieces without ever opening the Flash. The famous "arcade" hackers site had tutorials for novice users explaining how to get hacked decompiler, how to get swf from browser cache and how to change _url check code. Once the swf gets complicated enough so it requires knowledge of Flash, they wont bother anymore. I mean if they know how to break every swf they can also build similar game from scratch.

You dont even have to include the bytecode inside swf, you can load it dynamically from server using binary socket.

The example only has little piece of code as bytecode, but you can include bitmaps, sounds and everything else same way. That again would make businesses selling programs for "change bitmap graphics inside swf files with simple button click" slightly more difficult. Once the game-specific code is hidden as bytecode and game wont run without it, you would need to get all the code out first, then save whole file as fla, get the data from bytecode, recompilde bytecode into swf, decompile this swf, find the code which prevents stealing, change the data, create bytecode from changed swf, create new swf from old fla and new bytecode. It is surely more complicated then current way of hacking by "replace url string".

Squize
08-04-2006, 12:55 PM
Excellent work T :)

Squize.

tonypa
08-08-2006, 07:07 AM
I think this fits better in AS3 forum now.