This is a blog about Flash & AS by betaruce :-)



Calendar

July 2006
M T W T F S S
« Jun   Aug »
  1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31  

July 27, 2006

AS3: …(rest) parameter

Filed under: Tutorials — betaruce @ 12:01 pm

This may look strange at the first sight. Actually this new keyword allows function to accept any number of arguments.

Actionscript:
  1. function testing(...rest){
  2. trace(rest);
  3. }
  4. testing(1,2,'abc','def') // output: 1,2,abc,def

The arguments need to be separated by comma, and they will be stored into the array named "rest". It is not a must to name it "rest". You can use whatever names, just make sure you do not use other AS keywords.

Actionscript:
  1. function testing2(...student){
  2. trace('There are ' + student.length + ' students'); //
  3. trace('The 1st student is '+ student[0]);
  4. trace('The 3rd student is '+ student[2]);
  5. }
  6. testing2('Peter','Mary','Albert','Joyce');
  7. /*
  8. output:
  9. There are 4 students
  10. The 1st student is Peter
  11. The 3rd student is Albert
  12. */

You can also use with other predefined parameters, and ...rest need to be the last parameter specified.

Actionscript:
  1. function myFriends(myName, ...friends){
  2. trace('My name is ' + myName);
  3. trace('I have ' + friends.length + ' good friends. They are:');
  4. for(var i:int in friends){
  5. trace(friends[i]);
  6. }
  7. }
  8. myFriends('Peter','Mary','Joseph');
  9. /*
  10. output:
  11. My name is Peter
  12. I have 2 good friends. They are:
  13. Mary
  14. Joseph
  15. */

...rest is recommended instead of the arguments object. They are very similar, but the new ...rest do not have functionality like arguments.callee.

• • •

July 24, 2006

Can I use AS3 as a scripting language in the timeline just like before?

Filed under: Tutorials — betaruce @ 1:32 am

This maybe the question in many users mind when they first touch AS 3 and Flash 9 Alpha. Can I code in the old way instead of typing those OOP stuff?

The answer is YES. So when should I use it as a scripting language and when as an OOP project? And is there an example of coding in the scripting-language-style?

You may find the answer here: http://as3.betaruce.com/tut/appendix/app_1/app_1.html

----------------------------------------------
AS 3 tutorial by betaruce
http://as3.betaruce.com/tut/

• • •

July 23, 2006

ASCII Art output by AS3

Filed under: My Flash Programs — betaruce @ 11:46 pm

After visiting Maso's website on ASCII image generated by AS3, I also try to make one myself for fun. First convert a pic into grayscale, then match the converted pixels with some characters and output the result.

It's fun to play with but the effect is, of course, affected by many factors e.g. font size, original image dimension, etc. However, I would say this is a good exercise for practising AS :) (maybe I can include that in a tutorial later?)

http://as3.betaruce.com/ascii/ascii.html
You can see the original image, the grayscale image, and the output 'image'.

http://as3.betaruce.com/ascii/car.html
I have copy out the output 'image' and make it into a html.

• • •

Some articles on AS 3 for more advanced users

Filed under: Using Flash — betaruce @ 1:54 pm

Grant Skinner has some good analysis on the backend garbage management of AS. Unlike the previous AS versions, AS 3 is more like a "traditional" OOP programming language e.g. Java or C. Thus there's more resources problem for programmer to think when they program in AS 3.

Read the article here:
http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html
http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html

Visit his blog for some other related articles.

• • •

July 19, 2006

AS 3 Tutorial (Japanese version)

Filed under: Tutorials — betaruce @ 6:19 pm

I would like to thank Katsunori Nagai (http://www.himco.jp/articles.cfm) from Japan for translating my tutorials into Japanese. I know that there are many Flash user from Japan visiting this site and I hope the translation will help :)

Here is the link to the Japanese version: http://www.himco.jp/articles/pdf/AS3Tut.swf

I have been quite busy recently but I have not stopped writing the tutorials. If you have any suggestions you may leave a message here :)

• • •

July 9, 2006

AS3: Water Spectrum

Filed under: My Flash Programs — betaruce @ 6:20 pm

Combine the new computeSpectrum of the SoundMixer class with some water ripple effect

http://as3.betaruce.com/WaterSpectrum/WaterSpectrum.swf

Turn on your speaker. The larger the value computeSpectrum returns, the more the ripples e.g. when the song goes silent, there will be less ripples.

Song: Last War by Jay (3.9MB mp3 loaded dynamically into swf)

Update: Download the source here. Let me know if you still encounter any errors :)

• • •

July 8, 2006

Tutorial 4: Revision and some new concepts

Filed under: Tutorials — betaruce @ 11:49 pm

http://as3.betaruce.com/tut/tut_4/tut_4.html

I will talk more on events e.g. how to use double click. I will also talk about how to use imported image in Flash when there is no more things like attachMovie.

--------------------------------------------------
Access all the tutorials here:
http://as3.betaruce.com/tut/

• • •

July 7, 2006

Book recommended: Web Color Stylist of Designer

Filed under: Good books — betaruce @ 3:39 pm

I bought this book a few days ago and I find it quite interesting. It talks about colors: what a color consists of, what feelings/messages different colors convey, how to match colors for use in web design, etc.

It is written by a Korean web designer and is translated to Chinese.

• • •

July 6, 2006

Is Flash 9 preview a Trial?

Filed under: Flash Events — betaruce @ 3:33 pm

There's some confusion over this matter (even myself is confused) and the answer is:

- If you own Flash 8 or Studio 8, then you can use it for a long time
- If not, then it is a 30-day trial

Honestly speaking, I don't think Adobe has made it clear on the website. Tho Mike Downey mention that it is in the FAQ, I wonder how many people will really go and read it (and the FAQ button seems not obvious at all).

It's better for Adobe to make it clear on the first page of the preview release site.

• • •

July 3, 2006

Tutorial 3 - Events

Filed under: Tutorials — betaruce @ 11:11 pm

Here comes tutorial 3 - Make things move and interact with Events. This tells you how to make objects respond to events.

http://as3.betaruce.com/tut/tut_3/tut_3.html

I have also grouped my tutorials in a simple website for faster reference.

http://as3.betaruce.com/tut/

I hope my tutorials can help you guys to start coding AS 3. Everyone is new to AS 3 and maybe professionals only have several months more experience in it than you do. Feel free to leave a comment if you have any problems or suggestions and we may discuss together :)

• • •
— Next Page »

Powered by: WordPress • Template by: Priss

cheap phentermine phentermine site phentermine effects online phentermine phentermine prescription buy phentermine online phentermine alternatives phentermine deit pill cheap generic phentermine order phentermine online Clenbuterol Phentermine online pharmacy phentermine buy phentermine weight loss pill Cialis Comparison Viagra Cheap Viagra Online Prescription generic viagra sale viagra online viagra viagra pill discount sale viagra Generico Impotencia Viagra viagra sildenafil citrate Xanax Online xanax order xanax valium versus xanax