Qi Labs has a good article on using Flex components in Flash ( which
is kinda like what you are trying to do )

http://labs.qi-ideas.com/2007/12/25/using-flex-compiled-code-within-flash/

basically you package up all of the Flex framework classes you need
and all of their dependancies and turn it into a swc that you can
compile your AS3 code against. Unfortunately, Flex components tend to
have A LOT of dependancies which makes it hard to keep file size down
as Alex mentioned.

Jamie

On Thu, Jul 10, 2008 at 3:31 PM, Alex Harui <[EMAIL PROTECTED]> wrote:
> Flex components must live inside an Application.  You can subclass
> Application and get everything to work via AS3, but it's a lot of work, and
> you won't save any SWF size
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of jack_freud
> Sent: Thursday, July 10, 2008 10:34 AM
> To: [email protected]
> Subject: [flexcoders] flex components in pure as3 app - possible?
>
>
>
> Is it absurd to try to code a simple app in pure as3 that uses flex
> components like Button and Scrollbar?
>
> I've been trying and ran into problems with a bug in the Flex
> framework having to do with resources
> (http://bugs.adobe.com/jira/browse/SDK-12205), used Rob Jellinghaus's
> workaround, and came up with this simple code, below.
>
> The sprite will draw itself, but the button does not show up.
>
> Could anyone tell me if there's something basic I'm not understanding,
> or am I making a simple dumb mistake?
>
> Thanks!
> Jack
>
> package {
> import flash.display.Sprite;
> import flash.display.StageAlign;
> import flash.display.StageScaleMode;
> import flash.system.ApplicationDomain;
>
> import mx.containers.Canvas;
> import mx.controls.Button;
> import mx.controls.Label;
> import mx.core.Singleton;
>
> public class ShellAS3 extends Sprite
> {
>
> public function ShellAS3()
> {
>
> var resourceManagerImpl:Object =
> flash.system.ApplicationDomain.currentDomain.getDefinition("mx.resources::ResourceManagerImpl");
>
> Singleton.registerClass("mx.resources::IResourceManager",Class(resourceManagerImpl));
>
> init();
> }
> private function init():void{
>
> stage.scaleMode = StageScaleMode.NO_SCALE;
> stage.align = StageAlign.TOP_LEFT;
>
> var ball:Sprite = new Sprite();
> addChild(ball);
> ball.x = 20;
> ball.y = 100;
> ball.graphics.beginFill(0xff0000);
> ball.graphics.drawCircle(0,0,40);
> ball.graphics.endFill();
>
> var bt:Button = new Button();
> bt.x = 200;
> bt.y = 200;
> bt.width=100;
> bt.height = 20;
> bt.label = "Click";
> addChild(bt);
>
> }
> }
> }
>
> 

Reply via email to