dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: making the mousetrailer do some work

  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    4

    making the mousetrailer do some work

    Hi, I nearly put this in the newbie section as I'm sure the question is very basic, but the coding seems so different to Flash MX.

    I'm using Adobe flash CS4 with a downloaded a mouse trailer made with actionscript2, how do I add a onClick event anywhere on the screen to make the movie jump to another scene in fullscreen mode?

    When I started without the trailer and just added a button with;

    stop();button1.addEventListener(MouseEvent.MOUSE_D OWN, mouseDownHandler);function mouseDownHandler(event:MouseEvent):void {

    gotoAndStop(1, "scene 2");

    }

    it works but when I add the mouse trailer there seems to be a class issue and the movie loops.

    Without even touching on full screen mode which is another issue.

    Also can anyone recommed a good book for the latest versions of Actionscripting thats not too abstract?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    your code example is AS3, yet you say the original is AS2: which version of AS are you planning on using? it's one OR the other. Can't be both.

    gparis

  3. #3
    Junior Member
    Join Date
    Apr 2010
    Posts
    4
    Hi again, I realised that afterwards the button code was AS3 but even when I add AS2 code it still doesn't work.
    I want to use AS2 to create a onpress event anywhere on the screen that sends the swf to another scene in fullscreen mode.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    well, what's your AS2 code? and what's the mouse trailer's code?
    impossible to debug without these..
    gparis

  5. #5
    Junior Member
    Join Date
    Apr 2010
    Posts
    4
    sorry I'm using flash CS4 and the code (which is AS2) in first frame of the fla for the mousetrailer is;

    stop();

    onLoad = function(){

    bt_inv.bg_bt_inv._xscale = Stage.width;
    bt_inv.bg_bt_inv._yscale = Stage.height;
    }

    var i:Number = 0;
    var cursorVisible:Boolean = false;

    bt_inv.onRollOver = function(){

    if(cursorVisible == false){
    Mouse.hide();
    }else{
    Mouse.show();
    }

    this.onEnterFrame = function(){

    var formFollowerElement:String = "mc_star";
    var formFollowerWidth:Number = Math.random() * 100;
    var formFollowerHeight:Number = formFollowerWidth;
    var formFollowerRotation:Number = Math.random() * 100;
    var formFollowerXposition:Number = _xmouse;
    var formFollowerYposition:Number = _ymouse;

    if(i<100){
    this.attachMovie(formFollowerElement, "element" + i, this.getNextHighestDepth());
    this["element" + i]._xscale = formFollowerWidth;
    this["element" + i]._yscale = formFollowerHeight;
    this["element" + i]._rotation = formFollowerRotation;
    this["element" + i]._x = formFollowerXposition;
    this["element" + i]._y = formFollowerYposition;
    i++;
    }else{
    i = 0;
    }
    }
    }

    bt_inv.onRollOut = function(){
    delete this.onEnterFrame;
    Mouse.show();
    }

    and then i tried adding;

    bt_inv.onRelease = function() {
    gotoAndStop("full","Scene 2");
    }
    which doesn't work of course...

    I tried using a button but the mousetrailer disappears when the cursor is over the button, which is not what I want to have happen;

    btn1.onRelease = function() {
    gotoAndStop(1, "scene 2");
    };

    what I would like in a nutshell is for the user to click and the flash movie jumps to another scene.

    a pretty basic question I know, but CS4 seems a bit different to FlashMX on the coding side.

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Use _level0.gotoAndStop("label")
    specify a timeline before the goto and use a label instead of scene names.

    gparis

  7. #7
    Junior Member
    Join Date
    Apr 2010
    Posts
    4
    Magic! it worked thankyou and I bought an AS3 book, although this was an AS2 question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center