PDA

View Full Version : Flash Lite (Flash on cellphones? Hax!)



dislekcia
23-01-2008, 12:53 AM
I'm busy learning Flash for my the game QCF is currently working on, so far I'm amazed at how easy it is to get stuff up and running on the phone itself compared to J2ME. Flash definitely has something going for it here, provided it managed to avoid the hassles of non-standardisation that plague Java on mobiles...

However, I have a few questions regarding Flash itself that I'm just not finding online... I really don't need yet another tutorial on how to write a linked list, I can already do all that in my sleep, what I need is insight into the structure of Flash.

So I'm asking a few questions of the guys with Flash experience here:

1. What's the scope of this Actionscript I'm writing? Does it apply only to a layer, only to a frame? Is it global? What gives?

2. Everything resource wise-seems to be about creating symbols as movies and renaming them. How can I create new instances of a movie and how can I encapsulate that in a class? Is it as simple as having a class member of the type of that movie?

3. What general structure do Flash programmers adopt? I remember that way back people used to use frames as a state storage mechanism of sorts, is that still best practice? With the inclusion of classes can we now use a simpler game-loop?

I'll add more questions as I come up with them... And I'll try to answer mine on my own, just in case ;)

-D

dislekcia
23-01-2008, 01:03 AM
Also, found a really nice Actionscript 2.0 reference that you can download (http://download.macromedia.com/pub/documentation/en/flash/fl8/flash_as2lr.zip).

-D

FuzzYspo0N
23-01-2008, 08:44 AM
1. What's the scope of this Actionscript I'm writing? Does it apply only to a layer, only to a frame? Is it global? What gives?

Usually the editors for flash have the code in sections, there is a global tab area usually its above all the other code. Then, each element each tiny little bit of anything can have its own code, anything with _root can access the rest of the scripts as easily. so button 1 has a function to calculate the width of the screen (tho that is done, its an exampe) , button 2 can call var a = _root.button1.doCalc(); So all code is visible from everywhere, the breaking apart of the code is useful for "this. " giving clarity to each elements code. Each element also controls its own timeline, and each element within each frame can have its own AS as well. Its crazy deep, but u just have to remember to keep the code seperated by element. For example all the sprite code can be kept in one self-containing sprite "graphic" or "movie clip".

The scope usually applies to whatever is active or selected, within the keyframe on the time line. This is awesome, cos u can create a sprite with hundreds of actions and animations, but in the global stage its one "symbol" that you can move and put out the way etc. and the controls apply to the symbol, not each instance of your player.

hope that helps,


2. Everything resource wise-seems to be about creating symbols as movies and renaming them. How can I create new instances of a movie and how can I encapsulate that in a class? Is it as simple as having a class member of the type of that movie?

Exactly, classes are well documented in flash, even online. The classes and buttons are as easy as varname = new SymbolName;
that makes each variable a spawn of the movie clip symbol.


3. What general structure do Flash programmers adopt? I remember that way back people used to use frames as a state storage mechanism of sorts, is that still best practice? With the inclusion of classes can we now use a simpler game-loop?

In flash you have all the options for loops, and running states as well. These can manage your time frames within the global code, and each seperate element manages its own information.
For example, a player sprite has its own animations, collision checking, and action code. I have an instance of this sprite on stage, and i control it with global keys. When i push the jump key, i can call the spriteName.jump(extraHigh); or i can say spriteName.gotoAndPlay(15); frames 15 to frame 30 contains a special powered up fading animation etc, to show cool jumping. Then at frame 30 inside the sprite, his code tells him to go to unpower up and fall back to the nearest platform. (this is generic game coding, its just split into levels of classes within elements, or global classes controlling elements that can "self manage" their own state.

I am looking for my one game example, it runs with classes, a main loop and a whole bunch of animated sprites as an example to how to use the flash lite engine...

Hope this helps, flash is so powerful but a largely untapped resource.

Oh : and, iv got the best actionscript/flash book thats called advanced flash 8 professional, visual quickpro guides. It doesnt waste time on the stuff you dnt need to know, yet it starts at the beginning it covers everything you can imagine from advanced tweening and animation, realtime video streaming, etcetc. Its AWESOME for games in flash. I suggest getting it, its like 250 - 300 for the flash 8 and 400 - 450 for the flash cs3 pro actionscript 3. Iv got both, tell me which version you using mayb i can just lend you the books. I can swing by sometime. I dont use them execessively atm. Iv got a book called skip intro for flash, which is user interface and usability design, its also incredible.

UntouchableOne
23-01-2008, 01:16 PM
Unfortunately I have no answers at all. I do have a question though. What do I need to get started with creating flash lite applications. I've been thinking about it for a while since I can run flash applications on my phone. I have some awesome ideas for mobile applications, now I just need a way to implement them.

FuzzYspo0N
23-01-2008, 02:22 PM
Take a look at flash 8 professional, it goes for about 7000 now, and u can get cs3 for a bit more. The professional edition is the only one that allows flash lite from what i recall, adobe.com will tell you more. thats all u need.

UntouchableOne
23-01-2008, 06:55 PM
Thanks for the info. Expect more questions from me once I have the tools.

cairnswm
24-01-2008, 07:56 AM
To do free Flash Lite development you could use haXe (www.haxe.org) that supports haxe lite since version 1.12. I played a bit with haxe about two years ago, and did not try any of the flash lite development.

there are systax highlighters for haxe in Eclipse and ConTEXT as development environments.

xyber
24-01-2008, 10:41 AM
Thanks for the info FuzzYspo0N and cairnswm. Flash does seem like an good way to go for mobile game development. I've been working with J2ME a bit and its pretty cool, but reading through developer forums about all the api bugs makes me worry.

FuzzYspo0N
24-01-2008, 10:55 AM
J2ME is powerful, especially on the newer enabled phones, its just largely limited by processor and graphics limits. To me the api is more then stable enough.

Flash, on the other hand is highly optimized, and using vector graphics in the games makes it faster then bitmap graphics, making a good fast smooth running game is easier in flash... for certain.
I appreciate j2me more cos of portability, availability and functionality, flash lite is kinda growing, so its more a matter of personal choice versus what you need from the device(the age old battle, on all fronts)

dislekcia
24-01-2008, 07:11 PM
Muchos gracias Fuzzy, I appreciate the explanations... I'm going to be putting together a stress-test for the phone tonight, I'll be sure to post more questions as they rock up ;)

-D

dislekcia
25-01-2008, 04:33 AM
Feh! Ptooie! Etc!

I just ran into a rather annoying Flash thing™... Every new development environment/API/wossname has a few little quirks that hold you up and give you massive headaches until you fix them, here's my first one in Flash:

Linkages.

Nowhere in all the code that I saw did I see anything about allowing library clips to be linked by Actionscript... I'd written 100% perfectly functional code (as it later turned out when I'd done teh linkings!) that simply refused to produce anything. For the record I was dynamically creating a class that had a movie clip in it that would then bounce around the screen, to see how many classes/movies/etc I could have running on the target phone at the same time. After scratching my head a lot and losing a couple of hours to futile debugging attempts like simply creating only a single class in code, then only the movie clip, then any damn clip I could actually do things to - I finally found out about the Linkage options by randomly clicking on menu items and seeing what they did.

Hah.

So, remember, if you're working programmatically in Flash, allow your movie clips to be linked via Actionscript (right click on object in library, Linkages, check the box that says "blah Actionscript yak", close window).

That was wonderfully annoying ;)

-D

FuzzYspo0N
25-01-2008, 08:43 AM
lol, dont forget to name all your base class pieces in the properties, so actionscript sees it as a type. The other trick of flash is using multiple swf files, localising your sprite to one swf file, and "loading" it whenever needed. this is awesome for mobile cos you have progress bars, and you can spawn copies of the loaded thing easily...

dislekcia
25-01-2008, 03:18 PM
lol, dont forget to name all your base class pieces in the properties, so actionscript sees it as a type. The other trick of flash is using multiple swf files, localising your sprite to one swf file, and "loading" it whenever needed. this is awesome for mobile cos you have progress bars, and you can spawn copies of the loaded thing easily...

Could you explain the loading thing a little more? I'd like to have that option... I've seen that most internet Flash games do that, how's it work?

I'm a-lookin' through mah properties now to add my base class names, was wonderin' iffa ah could do summink like that ;)

-D