• Home
  • About
  • Contact Us
  • Gallery
  • Video
  • Archives
  • Site Map
Grab the RSS feed

FlashBannerOnline

FlashBannerOnline
  • Home
  • FlashBannerOnline
  • Free Downloads
  • General
  • Tutorials
    • Adobe AIR
    • CSS
    • Fireworks
    • Flash
      • ActionScript
    • FLEX
    • Javascript
      • JQuery
      • MooTools
    • PHP

Render Event in AS3

  • ActionScript, Tutorials

    Posted on November 20th, 2009

    Written by Behrouz Pooladrag

    Related Posts

    • Events and Event Types in AS3
    • Flash Optimization – Activate & Deactivate Events
    • Flash Optimization – Object Pooling

    Tags

    .as update render enterframe, actionscript, actionscript 3 event.render, actionscript 3 render event, actionscript 3 where to update display objects event.enter_frame event.exit_frame, actionscript update render, adobe flex suspend rendering, AS3, as3 enterframe events, as3 event.render, as3 flash render video, as3 invalidate, as3 one or more enterframe, as3 render, as3 render completed, as3 render display event, as3 render event, as3 stop render event, banner as3 stage addeventlistener, enter_frame not called, Event, event current as3, event flash banners, event.render as3, event.render event flash, example event.render, flash as2 render event, flash as3 enterframe, flash as3 render event, flash frame addeventlistener enterframe, flash render event, flash.events.Event.RENDER, gotoandstop as3 scene, invalidating stage in flash, Render, render actionscript 3, render event, sprite enterframe event, sprite render function actionscript, stage invalidate render event, time based events in flash as3
    Render Event in AS3

    ActionScript has long since relied on the enterFrame (onEnterFrame) event for time-based actions, especially animation and actions relating to frame playback. In comparison, Director’s Lingo language has, not only an enterFrame event, but two other frame events, prepareFrame and exitFrame. Though ActionScript 3 has not aquired prepareFrame or exitFrame, it has gained a new frame event, render, or Event.RENDER (flash.events.Event.RENDER).

    The render event in AS3 is a frame event that occurs after enterFrame (flash.events.Event.ENTER_FRAME) allowing one more chance to do what you need to do before the screen updates its display.

    Unlike enterFrame, however, the render event will not be called unless the display object using it is attached to a stage (or in any display list attached to the stage). Also, render is not automatically called every frame, even if attached to the stage. In order for render to be called for the current frame, you must make a call to stage.invalidate() (flash.display.Stage.invalidate());

    about invalidate :

    Calling the invalidate() method signals Flash Player to alert display objects on the next opportunity it has to render the display list (for example, when the playhead advances to a new frame). After you call the invalidate() method, when the display list is next rendered, Flash Player sends a render event to each display object that has registered to listen for the render event. You must call the invalidate() method each time you want Flash Player to send render events.

    Example :

    var sprite:Sprite = new Sprite();
    stage.addChild(sprite);

    sprite.addEventListener(Event.ENTER_FRAME, enterFrame);
    sprite.addEventListener(Event.RENDER, render);
    stage.addEventListener(MouseEvent.CLICK, click);

    function enterFrame(event:Event):void {
    trace(“enter frame”);
    }
    function render(event:Event):void {
    trace(“render”);
    }
    function click(event:MouseEvent):void {
    trace(“click”);
    stage.invalidate();
    }

    Output Result  :

    enter frame
    enter frame
    enter frame
    click
    enter frame
    render
    enter frame
    enter frame
    enter frame
    enter frame
    …

    This entry was posted on Friday, November 20th, 2009 at 8:02 am and is filed under ActionScript, Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    You might also like

    Events and Event Types in AS3 Event objects used with EventDispatcher in ActionScript 3 are a little less generic than those used with ActionScript...
    EventDispatcher in AS3 ActionScript 3 uses the EventDispatcher (flash.events.EventDispatcher) class for all event handling. This class...
    TextField in AS3 1. Create a - Flash File(ActionScript 3.0) 2. Now go to your Actions tab, you can do this by pressing F9, or...
    FullScreen in AS3 Notes: This tutorial covers HTML changes as well. Flash requires an HTML to be in opened in your browser and load...
  • 0 Comments

    Take a look at some of the responses we've had to this article.

  • Post a Comment

    Let us know what you thought.

  • Name:

    Email (required):

    Website:

    Message:

  • Ad Ad

  • FlashBannerOnline.Com

  • Subscribe

    Enter your email address:

    | More

  • Blogroll
    • Random Flash Banner!
  • Tag Cloud

    • actionscript addChild addEventListener Adobe AIR Air Animation AS2 AS3 as3 preloader Banner beginFill BitmapData blog.flashbanneronline.com Class CSS Date Class draw Flash flash.net.URLLoader flash banner free flash banner generator flash banner happy new year flashbanneronline FlashBannerOnline.com flash banner online free flash player function game getChildIndex Javascript lightbox Loading Mysql new year flash banner Object Optimization package PHP Sprite tot Tweener URLLoader URLRequest web XML
  • Recent Comment
    • Behrouz Pooladrag on Flash Optimization – Freezing And Unfreezing Objects
    • Valerie on Flash Optimization – Freezing And Unfreezing Objects
    • FlashLord on RSS Reader for FlashBannerOnline Blog!
    • Behrouz Pooladrag on Using ActionScript 3.0 with PHP Loading External Variables
    • LUN on Using ActionScript 3.0 with PHP Loading External Variables
  • RSS FlashBannerOnline
    • Happy New Year 2012 & Gift!
    • New Templates Oval Light Added to Flash Banner Online
    • FlashBannerOnline started in Arabic language
    • Happy New Year 2011
    • New Templates Christmas 2011 Added at Christmas!
    • New Templates angel animate Added to Flash Banner Online
    • Added Tow New Preloader (Pro Preloader , Rotate Preloader)
    • Happy New Year , by new Theme (Christmas 2010)
  • Add to Technorati Favorites

    Subscribe
  • Google
    Custom Search

Copyright © 2009 FlashBannerOnline - Powered by Wordpress.

FBO by