A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with changing code from AS2 to AS3

  1. #1
    Junior Member
    Join Date
    Jan 2015
    Posts
    3

    Help with changing code from AS2 to AS3

    Hi,

    I just got the new Flash CC and am not used to AS3 coding.

    Would someone be able to help me changing this code so it will work in AS3?

    It is for an expandable banner on a webpage *..

    Stage.scaleMode="noScale";
    Stage.align = "TR";

    expand1.onRelease = function () {
    getURL("javascript:resizeobj('cascade',970,460)");
    gotoAndPlay("cascade1");
    }


    Thank you!

    * It is a banner that looks a little like the one on this page: http://www.cbssports.com/?adTargetin...i_demo_cascade
    I want to add the 3d style unfolding to it like in the example and to do so I need to use the 3D rotation tool which has to be AS3.

    Cheers,

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    San Jose California
    Posts
    144
    Quote Originally Posted by J_83 View Post
    Hi,

    I just got the new Flash CC and am not used to AS3 coding.

    Would someone be able to help me changing this code so it will work in AS3?

    It is for an expandable banner on a webpage *..

    Stage.scaleMode="noScale";
    Stage.align = "TR";

    expand1.onRelease = function () {
    getURL("javascript:resizeobj('cascade',970,460)");
    gotoAndPlay("cascade1");
    }

    Cheers,
    I'll admit I don't know what the getURL link is doing, maybe some kind of external call to a cascade function?

    Everything else however -

    //just different syntax
    stage.align = StageAlign.TOP_RIGHT;
    stage.scaleMode = StageScaleMode.NO_SCALE;

    expand1.addEventListener(MouseEvent.CLICK, onClick); // add a listener to call the function

    function onClick(e:MouseEvent):void {
    // do something equiv to getURL javascript call
    gotoAndPlay("cascade1");
    }

    hope that helps
    - Brian

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Does this help you?

    PHP Code:
    import flash.external.ExternalInterface;
    import flash.events.MouseEvent;

    stage.align StageAlign.TOP_RIGHT;
    stage.scaleMode StageScaleMode.NO_SCALE;

    expand1.addEventListener(MouseEvent.CLICKonClick);

    function 
    onClick(e:MouseEvent):void
    {
        if (
    ExternalInterface.available)
        {
            
    ExternalInterface.call("resizeobj"'cascade',970460);
        }
        else
        {
            
    trace("No cigar");
        }
        
    //gotoAndPlay("cascade1");

    or if you want to try a more traditional type url then look here http://snipplr.com/view/15367/naviga...ascript-popup/

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