Wednesday, 15 February 2012

flex - How can I import symbols from Flash CS in MXML? -



flex - How can I import symbols from Flash CS in MXML? -

i'm writing mobile app in flex flashdevelop , using flash cs6 create visual assets. created symbol in flash cs6 , exported ac3 swc, imported flashdevelop project. created class it, so:

package com { import flash.display.sprite; public class volmeter_class extends sprite { private var design:volmeter; public function volmeter_class() { trace("i'm mysymbol instance called", name); design = new volmeter(); addchild(design); } } }

i'm seeking display symbol created on page of app. this, suspect expected somehow import in mxml, have no thought how so. can give me few tips on how started doing this?

in flash pro, assure linkage specified symbol.

using published swc flash pro in actionscript build path of project, symbol may instantiated linkage. or, symbols may embedded published swf of flash pro.

pure actionscript example:

package { import flash.display.sprite; public class appexample extends sprite { public function appexample() { var examplesymbol:examplesymbol = new examplesymbol(); addchild(examplesymbol); } } }

flex mxml example:

<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" creationcomplete="creationcompletehandler(event)"> <fx:script> <![cdata[ import mx.events.flexevent; protected function creationcompletehandler(event:flexevent):void { var examplesymbol:examplesymbol = new examplesymbol(); symbol.addchild(examplesymbol); } ]]> </fx:script> <s:spritevisualelement id="symbol" /> </s:application>

another approach embed symbol linking swf flash pro.

flex mxml embed example:

<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"> <fx:script> <![cdata[ [embed('assets/library.swf', symbol = 'examplesymbol')] [bindable] public static var examplesymbolclass:class; ]]> </fx:script> <s:image source="{examplesymbolclass}" /> </s:application>

flex flash-cs5 flashdevelop

No comments:

Post a Comment