Running into strange behaviour with flex 3.5. Here is a minimal code: build.xml target:
<target name="player">
<mxmlc
file="${APP_ROOT}/player.mxml"
output="${APP_ROOT}/player_old.swf"
keep-generated-actionscript="false"
static-link-runtime-shared-libraries="true"
debug="false">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.library-path dir="${APP_ROOT}" append="true">
<include name="lib"/>
</compiler.library-path>
</mxmlc>
</target>
player.mxml:
<?xml version="1.0"?>
<PlayerApp
xmlns="*"
xmlns:fx="http://www.adobe.com/2006/mxml">
</PlayerApp>
PlayerApp.as:
package {
import flash.display.Sprite;
import flash.media.Video;
import flash.events.*;
public class PlayerApp extends Sprite {
public function PlayerApp() {
this.loaderInfo.addEventListener(flash.events.Event.INIT, init);
}
private function init(e:Event):void {
this.addChild(new Video());
trace("loaderInfo: "+root.loaderInfo.width+"x"+root.loaderInfo.height+"\n");
trace("root stage: "+root.stage.width+"x"+root.stage.height+"\n");
}
}
}
the object:
<object width="320" height="240" id="_261178285" name="_261178285" data="player_old.swf" type="application/x-shockwave-flash">
<param name="allowfullscreen" value="true">
<param name="allowscriptaccess" value="always">
<param name="quality" value="high">
<param name="cachebusting" value="true">
<param name="wmode" value="opaque">
<param name="flashvars" value="config={irrelevant}">
</object>
Running all this with a debug player produces the following trace:
loaderInfo: 500x375
root stage: 320x240
This leads to a situation where a Video(contained within a Sprite) added to the app is only displayed as 250x154 or so in size as the 500x375 is squeezed into the 320x240 element it is contained within on the page.
Onward to the question: Is it possible to avoid this bug in any way so that the swf will still work with flash version 9.0.115. I also would rather not hard-code the size in the build.xml file, as the player size could change in the near term future.
Disclaimer: I'm using flex 3.5 as flash player 9.0.115 must be supported AND flash 9.0.115 must be supported because of corporate customers (Even 9.0.115 seems to be too much asked for some.) I also noticed I can compile the .as without the .mxml, but I left it here as is.
Have a look at Stage.scaleMode resp. the scale
property on object/embed tags.