Note that there are some explanatory texts on larger screens.

plurals
  1. POCan some one explain to me why the behavior of this ActionScript code is auto scale?
    primarykey
    data
    text
    <p>I'm new to AS3 and I'm doing some custom video player video project for AIR. While I was studying the simple examples (non-StageVideo) on how to play videos, I've encountered a unique situation where I got an awesome auto-scaling (stretch-to-fit) to window behavior from Flash.</p> <p>Whenever I set the SWF directive's width and height equal to the width and height of the flash.media.Video object I'm creating. It does the auto-scaling, stretch-to-fit, resizable behavior. Like so:</p> <pre><code>// SWF directive placed before the class declaration of the main class [SWF( width="1024", height="576", backgroundColor="000000", visible="true" )] // somewhere in my initialization myvid = new Video(); with( myvid ) { x = 0; y = 0; width = 1024; // if I set this wxh equal to wxh in the SWF directive it auto-scales! height = 576; } myvid.attachNetStream( myns ); addChild( myvid ); // must come after instancing of video and netstream, and attach to make the auto-scale work myvid.play( "somevideo.flv" ); </code></pre> <p>Even if I set the width to 16 and height to 9 on both it scales and fits perfectly on the size of my window. <strong>Can some explain me this behavior? None of what I read in the documentation mentioned this.</strong></p> <p>Don't get me wrong, I like this behavior! :) It made things easier for me. But code-wise I need to understand why is this happening as the code I set had nothing to do with auto-scaling.</p> <p><strong>Also, what the heck are directives for? Don't they just have pure ActionScript 3 equivalent? They look hackish to me.</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload