Recently a trainee asked me – How do we go about plotting a sine wave?  We were doing a basic ActionScript course and I was explaining the Drawing API, and how we could easily draw circles and rectangles etc. We then got into working out distances and I mentioned that it is all down to Pythagoras’ theorem, and from there we talked about cosine and sine and the question was  - How do we go about plotting a sine wave?

Well, drawing anything in ActionScript 3 can be accomplished by the lineTo() function, and it would have to run off an ENTER_FRAME event, so that gave us the skeleton functionality of our code…

 

In training, I frequently create examples on my mac, get them working, tweak them, and then copy them over to my trainees pcs. In doing so, I have come across a few problems that I thought I would share with you, and the solutions (not perfect) that I have  used to fix these issues.

What I normally do is create a new Actionscript project on my mac. Create and test the files and get everything ready for the training.

Then I copy the whole project folder onto a training pc, and sometimes I end up with problems. For example…

 

Using Flash Builder a lot as I do I am always on the look out for new extensions.  Recently I came across a lovely new extension from Adobe. It is called Blueprint.

Blueprint – a Flash Builder Extension, allows you to search the web for examples of code, directly within Flash Builder.

For example, suppose you are  tweening and want to see what examples you can find regard the Tween class. Just highlight Tween and press CTL-B (Mac) or Alt – B (PC).

This brings up the Blueprint panel, with the search results.

Blueprint panel

 

ByteArrays are very useful. I use them when saving image data out in the form of jpgs or pngs. You can also use them with sound data.

However someone recently asked me what about video? Can we use them to hold video data?

Well, pre-flash player 10.1 the answer is no. But now with flash player 10.1 you can use ByteArrays and videos with Actionscript 3. The methods concerned are…

appendBytes()

appendBytesAction()

…running off the NetStream class.

 

Frequently when playing around with code I need an object to play around with. So I created a Ball.as class. This testing class for Actionscript 3  is useful because it will just create a ball, with a default size and colour, which I can override if I wish.

I have also given it a bounceEffect() and bounce() public methods.

These will give a bounce effect when it hits a boundary and the latter will make it move and bounce from the boundaries.  The boundary at the moment is just stage.stageWidth and stage.stageHeight, but I plan on allowing an object to be sent so that the instance can use its hight and width as the boundaries for bouncing.

 

As I mentioned previously, Box2DFlash 2.1 is quite different from previous versions of Box2DFlash.

The major differences that I have found so far, are related to how to setup your world and your bodies (bearing in mind that I have only just started with Box2DFlash, and do not know the previous versions).

It took me a while to get my head around the Box2DFlash 2.1 relationship between fixtures, shapes, and bodies.

 

I recently decided to have a play with Box2DFlash. This is a port of a popular 2D physics engine that has been ported to Actionscript 3, Java, C#, etc.

A lot of games use Box2DFlash and so I thought it was about time to play around with it.

Also, i thought it would be a nice idea to blog about my progress. I will be using Flash Builder 4 (beta) to do all my work in, but the files can be used in Flash, or a.n.other development environment.

Firstly you will need to download the files from here…

 

Happy new year everybody – and in january this year I am in the process of creating a new, advanced, actionscript 3 course – during which I decided to do some particle work.

Here are some particle systems that I came across in the process…

Flint
Pulse
Desuade
Stardust

…the latter is a new system, and I must say that I am impressed.

It is a nice system, easy to use, good documentation, and some lovely demos.

In particular, have a look at this one…

Butterflies

Check Stardust out, you will not be disappointed.

Did you like this? Share it:
 

I have just found a new framework called HYPE. It looks to be a lovely actionscript 3 framework for coders and con-coders alike to easily create effects, and i plan to have lots of fun with it :-)

You will need some basic as3 knowledge, but you can quickly get results with a minimal amount of coding, and there are some lovely examples on the HYPE website.

Have a look at it and let me know what you think

hype

Did you like this? Share it:
 

Whilst I love Flash Builder, it is somewhat daunting navigating the large amount of preferences. So, if you wish to change the font, size, and colour of your editing window here is where you go…

Window > Preferences > General > Appearance > Colours & Fonts > Basic > Text Font

For the background colour and stuff like that you go to …

Window > Preferences > General > (and click on the text) Text Editors

At the bottom of the panel you will now Foreground colour, Background colour etc.

Google Adwords

© 2011 The Highlander Blog Suffusion theme by Sayontan Sinha