Copy link to clipboard
Copied
Hello.
I've noticed that new compiler works differently when using construct Embed with conditional compilation (comoiler define option).
It looks like new compiler always embeds files in output swf even if Embed construct is used in dead code. Here is full example:
package {
import flash.display.MovieClip;
public class Main extends MovieClip {
CONFIG::FOO {
[Embed(source="foo.mp3")]
public static var MusicTrack: Class;
}
CONFIG::BAR {
[Embed(source="bar.mp3")]
public static var MusicTrack: Class;
}
}
}
I have 2 files: foo.mp3 (~2MB) and bar.mp3 (~2.3MB). I want to embed only one of them defining CONFIG::FOO as true and CONFIG::BAR as false.
When I compile it using AIR 3.5 with following command I get (as expected) file with size ~2.0MB:
/opt/adobe_sdks/flex_sdk_4.6_AIR_3.5/bin/mxmlc -compiler.source-path . -swf-version 14 -define=CONFIG::FOO,true -define=CONFIG::BAR,false -o Main.swf -- Main.as
(...)
/private/tmp/bug/Main.swf (2030814 bytes)
But when I use newer AIR sdk (I tried with 3.7, 3.8 and 4.0 beta) I'm getting file with size ~4.3MB.
/opt/adobe_sdks/AIR_4.0/bin/mxmlc -compiler.source-path . -swf-version 14 -define=CONFIG::FOO,true -define=CONFIG::BAR,false -o Main.swf -- Main.as
(...)
4328386 bytes written to /private/tmp/bug/Main.swf in 9,634 seconds
Is it expected behaviour? Is there any chance that new compiler will work in this case the same as older one?
Copy link to clipboard
Copied
Another difference I encountered is that using compiler definition directly in Embed construction doesn't work. Here is example:
public class Assets {
[Embed(source=CONFIG::MUSIC_MP3_PATH)]
public static var MusicTrack: Class;
}
Then I pass option to the compiler:
-define=CONFIG::MUSIC_MP3_PATH,"'sfx/music.mp3'"
With AIR 3.5 SDK it works fine. With AIR 3.7, 3.8 and 4.0 beta I'm getting file which is smaller in size (by mp3 file size) and when running I get error: TypeError: Error #1007: Instantiation attempted on a non-constructor. (when it tries to create new instance of MusicTrack).
Copy link to clipboard
Copied
I also saw that when embedding fonts you cannot use systemfont as a source anymore... don't you?