Info

Adform Extend Button component ensures the proper performance of dragging function in Video Extender banners

Events

You are able to listen to these Adform events:

  • EXPAND_START - when a banner starts expanding;
  • EXPAND_END - when a banner stops expanding;
  • EXPAND_UPDATE - while a banner is expanding;
  • COLLAPSE_START - when a banner starts collapsing;
  • COLLAPSE _END - when a banner stops collapsing;
  • COLLAPSE _UPDATE - while a banner is collapsing;
  • DRAG_START - when a banner starts extending;
  • DRAG_END - when a banner stops extending;
  • DRAG_UPDATE - while a banner is extending.

Examples

stop();

// 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(5);
}
// Add event listener for expand end event
SingleExpanding.addEventListener(SingleExpandingEvent.EXPAND_END, handleExpandEnd);
function handleExpandEnd():Void
{
    // play expanded animation of MovieClip on stage named "animation" which has frame animation inside it
    _root.animation.gotoAndPlay(2);
}
// Add event listener for expand update event
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.
    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 start event
SingleExpanding.addEventListener(SingleExpandingEvent.COLLAPSE_START, handleCollapseStart);
function handleCollapseStart():Void
{
    // remove expanded animation of MovieClip on stage named "animation" which has frame animation inside it
    _root.animation.gotoAndStop(1);
}
// Add event listener for collapse end event
SingleExpanding.addEventListener(SingleExpandingEvent.COLLAPSE_END, handleCollapseEnd);
function handleCollapseEnd():Void
{
    // Go to first frame, where collapsed content is located
    _root.ball.gotoAndStop(1);
}
// Add event listener for collapse update event
SingleExpanding.addEventListener(SingleExpandingEvent.COLLAPSE_UPDATE, handleCollapseUpdate);
function handleCollapseUpdate(e:Object):Void
{
      // Current collapse animation coordinates and size expressed in a number between 0 and 1.
    var pos:Number = e.position;
    
    // Play animation backwards of MovieClip on stage named “ball”, which has frame animation inside it
    var t:Number = _root.ball._totalFrames;
    _root.ball.gotoAndStop(Math.round(t * (1-pos)));
}
// Add event listener for drag start event
SingleExpanding.addEventListener(SingleExpandingEvent.DRAG_START, handleDragStart);
function handleDragStart():Void
{
      // add your code to be executed
}
// Add event listener for drag end event
SingleExpanding.addEventListener(SingleExpandingEvent.DRAG_END, handleDragEnd);
function handleDragEnd():Void
{
     // add your code to be executed
}
// Add event listener for drag update event
SingleExpanding.addEventListener(SingleExpandingEvent.DRAG_UPDATE, handleDragUpdate);
function handleDragUpdate(e:Object):Void
{
    // Current size SingleExpanding expressed in a number between 0 and 1 of x and y directions
    var posX:Number = e.positionX;
    var posY:Number = e.positionY;
    
    var pos:Number = Math.max(posX,posY);
    
    // Play animation backwards of MovieClip on stage named “ball”, which has frame animation inside it
    var t:Number = _root.ball._totalFrames;
    _root.ball.gotoAndStop(Math.round(t * pos));
}

Weight

ActionScript2:

  • ExtendButton – 8126 bytes;
  • SingleExpand - 6334 bytes.