PDA

View Full Version : AS1 reference



townivan
04-01-2006, 08:19 AM
Since plugins are strictly ActionScript 1.0
Can anyone suggest a good book or site that only talks about AS1?

Most of the websites that I find are "what's changed from 1.0 to 2.0.
I fear that the 1.0 stuff will be shrinking as 3.0 comes out so I want to have something that I can go to while I can get it.

jobem
04-02-2006, 06:40 PM
Hi Ivan,

You are right. It is getting harder to find AS 1 only materials. I've written serveral books on the subject, and Mike has too. You can see most of them listed on this page:
http://www.electro-server.com/documentation/publications.aspx

Or here are some rules of thumb that you can apply to AS 2 that will make it AS 1 (for plugins):
- Remove strict typing. Instead of var name:String = "Ivan" it would be var name = "Ivan".
- Custom classes are not supported. So you cannot write your own class.
- All visual and audio related things are gone. So in AS 1 in a plugin you cannot talk to movie clips, images, audio, video, printing, context menus, etc. This is common sense I think.
- No XML is natively supported.
- ALL basic fundamental stuff IS supported. This includes for loops, while loops, arrays, objects, strings, numbers, functions

Good luck :)

spellbindmedia
06-06-2006, 03:42 PM
Hi Jobe,

You didn't mention switch statements in your list, though I read in the built-in documentation/Help for Flash that it is an AS1 statement (Flash Player 4 to be exact).

Is it supported? I can't seem to make a section of my plugin code to work. I reverted to an if conditional and it worked just fine.

Thanks in advance for any assistance you or anyone will provide.

jobem
06-06-2006, 05:19 PM
Hi switch statements should work.

fedecp
07-12-2006, 12:12 AM
I had the same problem, i solve it replacing the switch with a bunch of if-else.

FreeFrank
07-12-2006, 08:37 PM
switch statements work...throw up your code and let's take a look at it.

h1280
07-13-2006, 01:43 PM
Switch statements do work!

Here is an example



function sendApplyItemCommand(nj) {
var action = "GS";
var msg = "" + nj.id + "|AI|";
switch (nj.itemAction) {
case "HP" :
msg += ("HP" + "|" + nj.health);
break;
case "TEL_I" :
msg += ("TEL_I" + "|" + nj.row + "|" + nj.col);
break;
default :
msg += nj.itemAction;
}
(nj.pendingPowerUp.length == 0) ? nj.vulnerable = true : 0;
var rawMsg = action + "#" + msg;
sendRawMessage("public", rawMsg);
}


I can't get #include to work though