Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-02-2009, 04:20 PM   #1
dub_beat
Senior Member
 
dub_beat's Avatar
 
Join Date: Sep 2007
Posts: 335
Default Flex Virgin

Hi,

I'm new to flex as of today.

I have an existing as3 project that i want to "sit" in an mxml application.

How can I do this
My original main.as file looks like this

ActionScript Code:
package {     import flash.display.Sprite;     import flash.events.Event;     import flash.text.TextField;     import framework.Controller;     import framework.IController;     import framework.Model;     import framework.IModel;     import framework.View;     import flash.display.MovieClip;     import flash.events.MouseEvent         /**      * ...      * @author DefaultUser (Tools -> Custom Arguments...)      */                   public class Main extends MovieClip     {         /*         * GUI Variables         * */         public var _loadButton:MovieClip = new MovieClip();         public var _playButton:MovieClip = new MovieClip();         public var _stopButton:MovieClip = new MovieClip();         public var _infotext:TextField = new TextField();         /**          * FRAMEWORK VARIABLES          */         public var model:IModel = new Model( );         public  var controller:IController = new Controller(model);         public  var view:View;                         public var maintxtx:TextField = new TextField();                         public function Main():void         {             if (stage) init();             else addEventListener(Event.ADDED_TO_STAGE, init);         }                 private function init(e:Event = null):void         {             removeEventListener(Event.ADDED_TO_STAGE, init);             stage.align = "TL";             stage.scaleMode = "noScale";             stage.frameRate = 30;                         view = new View(model, controller, this);                                             initGUI();         }         /**          * LOADING TRACK GUI          */         private function initGUI():void         {             view.initGUI();             view.addLoadingUIListeners();                     }                 }     }

Now I want to do something like this

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init">     <mx:Script>         <![CDATA[                 public var _loadButton:MovieClip = new MovieClip();         public var _playButton:MovieClip = new MovieClip();         public var _stopButton:MovieClip = new MovieClip();         public var _infotext:TextField = new TextField();         public var model:IModel = new Model( );         public  var controller:IController = new Controller(model);         public  var view:View;         view = new View(model, controller, this);                                 public function init():void                         {                 import flash.display.Sprite;                 import flash.events.Event;                 import flash.text.TextField;                 import framework.Controller;                 import framework.IController;                 import framework.Model;                 import framework.IModel;                 import framework.View;                 import flash.display.MovieClip;                 import flash.events.MouseEvent                  view = new View(model, controller, this);         _tracklist = new TrackList();             _cliplist = new ClipList();             _info = new Info();             _waveEditor = new WaveFormEditor();             _playhead = new Playhead()             addChild(_tracklist)             addChild(_cliplist)             _main.addChild(_info)                                     /*PLAYBACK GUI*/             _loadButton.graphics.beginFill(0xf5f5f5);             _loadButton.graphics.drawRoundRect(50, 50, 50, 50, 3, 3);             _loadButton.graphics.endFill();             _loadButton.buttonMode = true;             addChild(_loadButton)             _playButton.graphics.beginFill(0x00ff00);             _playButton.graphics.drawRoundRect(100, 50, 50, 50, 3, 3);             _playButton.graphics.endFill();             _playButton.buttonMode = true;             addChild(_playButton);                                                 }         ]]>     </mx:Script>         </mx:Application>

Im likely way off here . for example i get errors saying that loadbutton doesnt exsist. Also I get errors saying addChild isnt a recognised function name

Can somebody help me get off the ground?
__________________
interest is theft, Rent Robbery, and Profit Only Another Name for Plunder." Benjamin Tucker
dub_beat is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flex becoming SWF Parent? ackerchez Flex 2, 3 & 4 5 03-02-2009 12:29 PM
Excel and Flex interaction rico Flex 2, 3 & 4 1 08-01-2008 03:31 PM
Is flex for me??? roshankolar Flex 2, 3 & 4 4 09-27-2007 06:34 PM
xml will not parse correctly in ASP when sent from flex Daedalus ActionScript 3.0 0 05-04-2007 04:45 PM
Question about Flex 2 vistasoul Flex 2, 3 & 4 1 02-28-2006 04:07 AM


All times are GMT. The time now is 11:19 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.