Actionscript 2, Flash _, Open Source, Uncategorized, Web developer

MouseControl AS2 class update – added Mac mouse wheel and scrolling area support

In my previous release of this class MouseControl class – easy adding of mouse scroll wheel capability to Flash (AS2.0)
.
This release is bringing some nice additions,
like possibility of adding a Rectangle area that if mousewheel is used there trigger an assigned function…
example:
mouseControl.addScrollArea(“rect”, new Rectangle(100, 100, 100, 200), Delegate.create($class, traceRect));
where “rect” is id of scrollArea – used for removing a scroll area
second is rectangle parametar for scroll area
third is a function to call on mouse wheel

whole class is now relying on MacMouseWheel class from pixelbreaker

Download the source
Try the example

Standard
Actionscript 3.0, Actionscript 3.0 _, Flash, Flash _, Tutorials, Video, Web developer

Flash AS3 Beginners Tutorial – Adding library item to Stage [VIDEO]

Mirko Fisic did another nice and simple tutorial for understanding class creation and adding library item to Stage in Flash CS3, Actionscript 3 version. First he explains how to create a class, extending object and then he creates simple MovieClip in Library which then is added to stage. At the end, MovieClip acts as a Label, having its own method to set Label Text. Check it out, Mirko did again great work!

In Serbian / Na srpskom :

Mirko Fisic donosi jos jedan sjajan video tutorijal za pocetnike u Flash-u verziji 9 odn. Actionscript-u 3. Video tutorijal pokriva kreiranje nove klase, dodavanje simbola iz biblioteke (Library), i kreiranje metode koje tom simbolu menja tekst unutar njega. Jednostavan i efektan tutorijal koji Vam moze pomoci da savladate jedan od osnovnih koraka u Flash-u.

Ukoliko imate pitanja o tutorijalu slobodno ih postavite na Hagane Flash Forum-u

Mirko and Alex support FlashDevelop, you can support it too.

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Tutorials, Web developer

Simple Flash Example – Menu with library items and little bit actionscript

I did some simple example for beginners in Flash.
It is an example of a menu, standard looking but interesting. This example involves a little bit of core Actionscript skills, and it’s a more designer concept of programming in Flash.

SWF
FLA

menuItem library symbol contains a menu button
menu library symbol contains menu with menu items and actionscript code

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Tutorials, Web developer

MouseControl class – easy adding of mouse scroll wheel capability to Flash (AS2.0)

UPDATED VERSION CAN BE FOUND HERE :

https://mrsteel.wordpress.com/2008/07/31/mousecontrol-as2-class-update-added-mac-mouse-wheel-and-scrolling-area-support/

MouseControl class
for now just takes care of Mouse scroll wheel capability in Flash
MouseControl is Singleton class which lets you define movieclips and functions that should be invoked if user uses mouse scroll wheel over defined movie clip
it helps very much in situation when you need to define scrolling functionality in different classes of your Flash site or application

  • command addScroll(id, mc, function)
    example:
    MouseControl.getInstance().addScroll(“area1”, area1, Delegate.create(_root, moveFirst));
  • removeScroll(id)
    example:
    MouseControl.getInstance().removeScroll(“area1”);

example SWF : http://hagane.us/as/mousescroll/mousescroll.swf

source ZIP : http://hagane.us/as/mousescroll/MouseScroll.zip

I just also want to suggest that this is not correctly written Singleton class. Singleton classes should throw arror on attemp of basic class creation like:

var mouseControl = new MouseControl() ;

but mine is doing nothing, it is expecting that you use it correctly and that when you want to use class always use internal class instance (basic of Singleton), getting it with standard

var mouseControl = MouseControl.getInstance()

or with commands

MouseControl.getInstance().addScroll(id, mc, func)

avoiding doing proper Singleton is basiclly of AS2 which is not so strong typed language …
In AS3 I recommend you do proper Singleton – nice guide you can find on Grant Skinners blog

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Tutorials, Web developer

Simple accordion example in Flash 8 (Actionscript 2)

I made this really simple example of accordion usage replying to one forum question.
Nothing special to see, but good for beginners just to get simple things going and get more interested in Flash.

Beginners can play arround with symbols star,circle and square and their icons, also you can use few new AS lines to add more childes to accordition. Create new symbols for new childes, give them proper names and don’t forget to put export for AS and export in first frame in properties of movieclip (right click on symbol in library and choose Properties option) … Also don’t forget to use help on any topic in Flash, even if you think you know it good there are lot of usefull information and you can find some methods that are really interesting.

http://www.hagane.us/as/accordion/accordion.swf
http://www.hagane.us/as/accordion/accordion.fla

Standard
Actionscript 2, Flash, Flash _, Tutorials, Web developer

Flash image gallery example (Actionscript 2) – using PHP to list images from folder

this is simple gallery example for AS2
gallery is nothing special, ease to use and implement

interesting thing about this example is that you pass a folder, and PHP side gathers image list from a folder and returns it to the Flash in XML form together with images widths and height which makes it more easier to implement this sort of galleries like I’ve made

so from this example you can see :

  • PHP serving XML to Flash
  • PHP getting image size (width and height)
  • Flash loading XML
  • Flash creating elements on stage using library
  • loading external images
  • and more…

this example is for beginner level

example : http://www.hagane.us/as/gallery/
ZIP : http://www.hagane.us/as/gallery/gallery.zip

if you have any questions about PHP or Flash side please post it here

EDIT: sorry for wrong links and config. Everything is corrected now and fully functional
thanks people who noted me about errors!

Standard
Actionscript 3.0, Actionscript 3.0 _, Flash, Flash _, Flex, Web developer

AS3 PDF Creation with AlivePDF AS3 Alpha

Well, I’m sure that almost everybody is familiar with ByteArray.org and their amazing work featuring ASZip, AS3 Gif Player, Mouse Gesture, Live JPEG encoder, WiiFlash and more…
AlivePDF is WIP and now it’s in Alpha phase. AlivePDF is AS3 library for PDF creation based on FPDF PHP library.
Check it out at ByteArray.org – AlivePDF 0.1 Alpha Release

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Web developer

FLV Flash Video Player Tutorial Update – now with Sound Volume Control and Play Again button

After I’ve made simple tutorial that covers FLV Flash Video Player, determining duration of FLV through PHP and MetaData and also using a first frame as a video thumb in this New Years post
https://mrsteel.wordpress.com/2006/12/31/flv-video-playback-with-duration-time/

time has come to improve a player a bit, based on user wishes
I’ve added sound volume control and play again button
basiclly it was simple thing to do using the previous code, but for beginners it’s hard to manage things like this

for sound volume control standard Sound class is used like for every sound in Flash
about the Play Again button it’s just seek function for video and giving it 0 value as parameter

here is the demo SWF : http://hagane.us/as/flvplayer/
and zip source : http://hagane.us/as/flvplayer/flv.zip

just when you trying it out remember to put any FLV file named video.flv in the same folder

all the best
Alex

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Web developer

Custom setInterval replacement class – Timer from Misuta Hagane Util package

need for replacemenr of setInterval in AS2.0 is obvious, it happened to me and to other people many times that clearInterval just won’t work… it’s basiclly in only 1% of cases but it’s enough

so to help me and my friends I’ve created Timer class which fits into Misuta Hagane Utils package, which will soon get extension with some other interesting things (Misuta Hagane is my alias in Japanese language // my new homepage http://hagane.us)

MHU Package / Timer Class

initializing the class

– place com.hagane.MHU folder in root of your project
– import in flash project via AS

import com.hagane.MHU.Timer;

– create instance of the class

var timeKeeper : Timer = new Timer();

being that my class creates movieclip for enterframe events, by default it’s 32760 and it’s created in root and named timer, I made it possible that you tell in constructor what mc to use for timer
In that case you create instance like this

var mc:MovieClip = _root.createEmptyMovieClip(“mc”, 50);
var timeKeeper : Timer = new Timer(mc);

add interval function call

var intervalID_mc : Number = timeKeeper.intervalCall(time:Number, repeat:Number, func:Function, param: Parameters…);

time:Number – time in ms
repeat : Number – number of repeating, 0 and 1 for once, -1 for infinite
func : Function – function to call
param : Parameters – can be anything that fits into parameters of func – function you decided to call

function returns ID of your interval, which you will later use to clear interval

for example

var intervalID_num : Number = timeKeeper.intervalCall(999, 5, traceABC, 3, 5, 6, “myInterval”);

clearing interval

timeKeeper.clearIntervalCall(intervalID:Number);

In archive file you have everything set up for testing.
You will see main action is taking place in main.as which is included in first frame of FLA file.
MHU Package / Timer Class

if you have any question SHOOT!

Standard
Actionscript 2, Actionscript 2.0, Flash, Flash _, Web developer

Flash Font Embedding for displaying all styles on a TextField – bold, italic …

Flash can’t display by default all font style in a TextField. To be able to do that you need to embedd font with every style you plan to use in library separete. In a library menu (you get it when you click icon in Library title top right corner) and click on New Font option. Then you select font, and style you want to embedd and do it for every style you plan to use 🙂 I am repeating myself but that’s good for beginners.

SWF Example
FLA file

Standard