From September, Flash will no longer be supported by Chrome. Prepare for the shift towards HTML5 by visiting our Flash to HTML5 help page

Check it out!

Single File Expanding Component

Info

Adform Single File Expanding component ensures the proper performance of Adform Single File Expanding banners.

Examples

ActionScript2:

// Add event listener for expand start event SingleExpanding.addEventListener(SingleExpandingEvent.EXPAND_START, handleExpandStart);

function handleExpandStart():Void
{
       // Go to frame, where your expand content is located
       _root.gotoAndStop(2);
}

 // Add event listener for expand update event, which is fired during expand.

SingleExpanding.addEventListener(SingleExpandingEvent.EXPAND_UPDATE, handleExpandUpdate);
function handleExpandUpdate(e:Object):Void
{
// Current expand animation coordinates and size expressed in a number between 0 and 1.
// If you have custom animations you can synchronize them using this number.
var pos:Number = e.position;
// Example if you have MovieClip on stage named “ball”, which has frame animation inside it
       var t:Number = _root.ball._totalFrames;
       _root.ball.gotoAndStop(Math.round(t * pos));
}

// Add event listener for collapse update event, which is fired during collapse.
SingleExpanding.addEventListener(SingleExpandingEvent.COLLAPSE_UPDATE, handleCollapseUpdate);

function handleCollapseUpdate(e:Object):Void

{

       var pos:Number = e.position;
       var t:Number = _root.ball._totalFrames;

       _root.ball.gotoAndStop(Math.round(t * (1 - pos)));

       // When animation is complete go to first frame, where collapsed content is

       if (pos == 1)
       {
              _root.gotoAndStop(1);
       }
}

ActionScript3:

// Add event listener for expand start event
SingleExpanding.addEventListener(SingleExpandingEvent.EXPAND_START, handleExpandStart);
function handleExpandStart(e:SingleExpandingEvent):void
{
       // Go to frame, where your expand content is located
       this.gotoAndStop(2);
}

// Add event listener for expand update event, which is fired during expand.
SingleExpanding.addEventListener(SingleExpandingEvent.EXPAND_UPDATE, handleExpandUpdate);
function handleExpandUpdate(e:SingleExpandingEvent):void
{
       // Current expand animation coordinates and size expressed in a number between 0 and 1.
       // If you have custom animations you can synchronize them using this number.
       var pos:Number = e.position;

       var t:Number = ball.totalFrames;

       // Example if you have MovieClip on stage named “ball”, which has frame animation inside it
       ball.gotoAndStop(Math.round(t * pos));
}

// Add event listener for collapse update event, which is fired during collapse.
SingleExpanding.addEventListener(SingleExpandingEvent.COLLAPSE_UPDATE, handleCollapseUpdate);
function handleCollapseUpdate(e:SingleExpandingEvent):void
{
       var pos:Number = e.position;

       var t:Number = ball.totalFrames;

       ball.gotoAndStop(Math.round(t * (1 - pos)));

       // When animation is complete go to first frame, where collapsed content is
       if (pos == 1)
       {
              this.gotoAndStop(1);
       }
}

 

Weight
ActionScript2: SingleExpanding – 5734 bytes;
ActionScript3: SingleExpanding – 5452 bytes;