Thanks,
I had the problem which prevented ant from seeing the asset files, and that was fixed by adding a slash to the front of the asset path. That problem caused a compile error. This error only happens at run-time and only after compiling with recent builds using ant. I also tried using flex tasks and it produced the same runtime errors. It all works perfectly when I compile using flex_sdk_4.0.0.7219, with ant or otherwise. Josh From: [email protected] [mailto:[email protected]] On Behalf Of ag_rcuren Sent: Thursday, October 15, 2009 5:57 PM To: [email protected] Subject: [flexcoders] Re: Does the Embed metatag still work in the latest versions of the SDK? I had this problem once and it turns out that when you are using Flex builder it does some "magic" to the build path. This does not happen when you build with ant and I had to move some files around so that mxmlc could find everything. I believe that mxmlc can only see the src path and its sub directories, someone correct me if I am wrong. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "joshonemail" <j...@...> wrote: > > It works when compiling using interface in flex - using all sdks. > I get the problem when I compile using ANT, so it is most likely my own doing. > > My build.properties file: > SRC_DIR = ${basedir} > DEPLOY_DIR = ../bin-debug > # Flex 4-Beta 2 4.0.0.10485 Tue Sep 22 2009 > # Flex 4-Beta 1 4.0.0.7219 Wed May 13 2009 > # FLEX_HOME = C:\\flex_sdk_4.0.0.10547 > # FLEX_HOME = C:\\flex_sdk_4.0.0.7219 > # FLEX_HOME = C:\\flex_sdk_4.0.0.10485 > # FLEX_HOME = C:\\flex_sdk_4.0.0.10988 > FLEX_HOME = C:\\flex_sdk_4.0.0.10963 > MXMLC_EXE = ${FLEX_HOME}\\bin\\mxmlc.exe > FLASHPLAYER_EXE = ${FLEX_HOME}\\runtimes\\player\\10\\win\\FlashPlayer.exe > FLEX_TASK_JAR = ${FLEX_HOME}\\ant\\lib\\flexTasks.jar > > My build.xml: > <?xml version="1.0" encoding="utf-8"?> > <project name="EmbedTest" basedir="../src/"> > <property file="../build/build.properties" /> > <echo>MXMLC_EXE: ${MXMLC_EXE}</echo> > <!-- > - CLEAN > - deletes all files from bin-debug > --> > <target name="clean"> > <delete includeemptydirs="true"> > <fileset dir="${DEPLOY_DIR}" includes="**/*"/> > </delete> > </target> > > <!-- COMPILE --> > <target name="compile_embed_test"> > <echo>COMPILE</echo> > <exec executable="${MXMLC_EXE}" dir="${basedir}" failonerror="true"> > <arg line="'${SRC_DIR}\EmbedTest.as' " /> > <arg line="-o '${DEPLOY_DIR}\EmbedTest.swf' " /> > <arg line="-debug " /> > </exec> > </target> > > <!-- LAUNCH --> > <target name="launch"> > <echo>LAUNCH</echo> > <exec executable="${FLASHPLAYER_EXE}" errorproperty="trace.output"> > <arg line="'${DEPLOY_DIR}\EmbedTest.swf'" /> > </exec> > </target> > > <target name="clean compile launch" depends="clean,compile_embed_test,launch"/> > > </project> > > The source: > package > { > import flash.display.Bitmap; > import flash.display.Sprite; > > public class EmbedTest extends Sprite > { > > [Embed(source='/image_assets/ui/arrow.gif')] > private static var Arrow:Class; > > public function EmbedTest() > { > var arrow_bm:Bitmap = new Arrow(); > addChild(arrow_bm); > } > } > } > > I still get the same results as below when using ant with these parameters. Any thoughts appreciated. > > Josh > > > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "joshonemail" <josh@> wrote: > > > > Hi, > > I am embedding a graphic at compile using the Embed metatag in an AS3 > > project using Flash Builder 4. It compiles in both Beta 1 (build > > 4.0.0.7219) and Beta 2 (Flex 4-Beta 2 4.0.0.10485) - but in beta 2 it > > throw runtime errors. > > Here is how I embed:[Embed(source='/image_assets/ui/arrow.gif')] //the > > first slash is necessary for the compilerprivate static var Arrow:Class; > > Here is how I use the asset:new Scrollbar.Arrow() // as a Bitmap > > This is the runtime error I get after compiling with no errors in > > 4.0.0.10485 and later:VerifyError: Error #1014: Class > > mx.core::BitmapAsset could not be found.ReferenceError: Error #1065: > > Variable Scrollbar_Arrow is not defined. > > Has the method for embedding assets changed in an Actionscript project? > > Or am I missing something? likely! > > Thanks, > > Josh > > >

