September 28, 2009

Attractive Mouse Trailer using AS3


Notice the following sample swf and just move your mouse around the text to view the mouse trailer.


  1. Create new Flash File (File->;New or Ctrl + N) and Name it as mouse trailer.
  2. Draw circle with "gradient fill" like below image.












  3. Convert this image as an movieclip using Modify->covert to symbol or press F8, choose Movieclip.and name it as obj.
  4. Make new Movieclip (Insert-> New Symbol or press ctrl+f8) and name it as "glow".
  5. Drag and drop "obj" movieclip from Library.
  6. Now we are going to apply some filter effects. open "Filters" window (using window->properties->Filters)
  7. Apply Glow filter with color #FFFF00, Blur X:12 Blur Y:12, like below image











  8. Now apply Blur filter with Blur X value 5 , Blur Y value 5 like below image












  9. Then apply Gradient glow effect like below image.











  10. Now right click on "glow" movieclip in libraray and click on Linkage, now set Class name as "Element".
  11. Now press ctrl+N and choose Actionscript File to apply script .
  12. copy and paste below codes in to this , and save this file in the same location of your fla file.




    package digizone{
    import flash.display.*;
    import flash.events.*;

    public class mousetrailer extends MovieClip {
    private var count=4;
    private var x1=mouseX;
    private var y1=mouseY;
    public function mousetrailer() {

    addEventListener(Event.ENTER_FRAME,showTrailer);
    }
    public function showTrailer(e:Event) {
    if (x1!=mouseX||y1!=mouseY) {
    x1=mouseX;
    y1=mouseY;
    var glower:Element=new Element();
    glower.x=mouseX;
    glower.y=mouseY;
    glower.counter=0;
    glower.width+=15;
    glower.height+=15;
    glower.addEventListener(Event.ENTER_FRAME,fadeIt);
    addChild(glower);


    }
    }
    public function fadeIt(evt:Event) {
    evt.currentTarget.counter+=1;
    //verify if the objects showl start to die
    if (evt.currentTarget.counter>count) {
    //if it should die we start to fade it and also shrink it
    evt.currentTarget.alpha+=-0.03;
    evt.currentTarget.width=evt.currentTarget.height-=0.3;
    }
    //once it has faded completly, we remove the event from the object and also remove the object from the stage
    if (evt.currentTarget.alpha<=0)
    {
    evt.currentTarget.removeEventListener(Event.ENTER_FRAME, fadeIt, false); evt.currentTarget.parent.removeChild(evt.currentTarget);
    } } } }

  13. In mousetrailer.fla , open properties window and type your actionscript class name in Document class .
  14. Now press ctrl+Enter to run the application.
Download Sourcefile from here
 

About

we are doing all kind of web / standalone applications using Flash , FMS, PHP , XML , CSS , etc. we handle all projects starting from the initial design concept through the delivery of your personalized product. Our commitment to you is comprehensive and complete-aimed at satisfying your every need. We have the experience and the expertise to get the job done.

Site Info

we Currently handling web requirements and multimedia productions and we have the capability of cutting your web , graphics and multimedia expenses to a bare minimum without sacrificing professional quality or delaying production. Our focus is on the development of smart, successful ideas and we always strive to maintain the highest . we currently using following technologies Flash 8, Flash cs3,Actionscript 2 ,Action script 3 ,Flash Media server , PHP,AMFPHP,XML ,HTML ,CSS ,Photoshop

Text

Digizone, AnnaNagar East, Chennai, TamilNadu ,India. Please view our website for further details

Flash and photoshop resources FREE Download Copyright © 2009 Community is Designed by Bie