Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-11-2010, 10:43 AM   #1
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default How connect .mxml with .as?

Hi all!,

Im trying to get my .mxml file to compile with my .as files.

The thing is that I have moved the .as files and mxml files to different folders - Model(contains .as), View(contains .mxml) and Control(contains .as).
When I debug the .mxml get a launch error.

How do I get the .mxml to run with the .as files? I have tried this code with no luck!

ActionScript Code:
xmlns:control="Control.*" xmlns:model="Model.*" xmlns:view="View.*"                                             <Model:Appointment/>                         <Model:Link/>                         <Model:Note/>                         <Model:Person/>                         <Model:Research/>                                                 <View:PIM/>                         <Control:AppointmentController/>                         <Control:PIMController/>                                                 <Model:DataManager/>
Thank you in advance!
fluen is offline   Reply With Quote
Old 06-11-2010, 11:40 AM   #2
manish_raj
Registered User
 
Join Date: Jun 2010
Posts: 43
Default Adding .as fine in Flex

In the Flex
MXML language, the <mx:Script> tag lets you specify a source attribute that identifies
an external ActionScript file to be loaded at that point in the application. For example, the
following tag will load an external ActionScript file named Box.as:

<mx:Script source=“Box.as” />
manish_raj is offline   Reply With Quote
Old 06-11-2010, 02:11 PM   #3
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default

I have now tried to implement the code like this. But I still get the launch error. Can you tell me what to do in order to fix the problem?
Thank you.

ActionScript Code:
<mx:Script>         <![CDATA[         <mx:Script source=“Control.AppointmentController.as” />          <mx:Script source=“Model.DataManager.as” />           <mx:Script source=“Model.Information.Appointment.as” />            <mx:Script source=“Model.Information.Link.as” />             <mx:Script source=“Model.Information.Note” />              <mx:Script source=“Model.Information.Person.as” />               <mx:Script source=“Model.Information.Research.as” />                     import Control.PIMController;             import Control.AppointmentController;             import Model.Information.Research;             import Model.Information.Person;             import Model.Information.Note;             import Model.Information.Link;             import Model.Information.Appointment;             import Model.DataManager;
fluen is offline   Reply With Quote
Old 06-11-2010, 05:32 PM   #4
box86rowh
FLEX AND FLASH ARE COOL
 
Join Date: Oct 2005
Posts: 794
Default

dont nest the script tags, and the paths in the source attribute are file paths, not package paths,
ActionScript Code:
<mx:Script source="/Control/AppointmentController.as" />          <mx:Script source="/Model/DataManager.as" />           <mx:Script source="/Model/Information/Appointment.as" /> //and so on..            <mx:Script source="Model.Information.Link.as" />             <mx:Script source="Model.Information.Note" />              <mx:Script source="Model.Information.Person.as" />               <mx:Script source="Model.Information.Research.as" /> <mx:Script>         <![CDATA[             import Control.PIMController;             import Control.AppointmentController;             import Model.Information.Research;             import Model.Information.Person;             import Model.Information.Note;             import Model.Information.Link;             import Model.Information.Appointment;             import Model.DataManager;
box86rowh is offline   Reply With Quote
Old 06-11-2010, 08:02 PM   #5
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default

Now I have made the suggested changes. However, I am not entirely sure that this is what you ment. Forgive my ignorence. I still get the same launch error, so I would deeply appreciate some help
ActionScript Code:
<mx:Script     source="/Control/AppointsmentController.as"     source="/Control/PIMController.as"     source="/Model/DataManager.as"     source="/Model/Information/Appointment.as"     source="Model/Information/Link.as"     source="/Model/Information/Note.as"     source="/Model/Information/Person.as"     source="/Model/Information/Research.as"  />     </mx:Script> <mx:Script          <![CDATA[             import Control.PIMController;             import Control.AppointmentController;             import Model.Information.Research;             import Model.Information.Person;             import Model.Information.Note;             import Model.Information.Link;             import Model.Information.Appointment;             import Model.DataManager;
fluen is offline   Reply With Quote
Old 06-11-2010, 08:08 PM   #6
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default

Also tried this:

ActionScript Code:
<mx:Script source="/Control/AppointmentController.as" />         <mx:Script source="/Control/PIMController.as" />          <mx:Script source="/Model/DataManager.as" />           <mx:Script source="/Model/Information/Appointment.as" />            <mx:Script source="Model/Information/Link.as" />             <mx:Script source="/Model/Information/Note.as" />              <mx:Script source="/Model/Information/Person.as" />               <mx:Script source="/Model/Information/Research.as" />              <mx:Script>              <![CDATA[             import Control.PIMController;             import Control.AppointmentController;             import Model.Information.Research;             import Model.Information.Person;             import Model.Information.Note;             import Model.Information.Link;             import Model.Information.Appointment;             import Model.DataManager;
fluen is offline   Reply With Quote
Old 06-11-2010, 09:29 PM   #7
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default

I have also tried this with no luck. Any help shall be appreciated

ActionScript Code:
<mx:Script source="import/Control/AppointmentController.as" />         <mx:Script source="import/Control/PIMController.as" />          <mx:Script source="import/Model/DataManager.as" />           <mx:Script source="import/Model/Information/Appointment.as" />            <mx:Script source="import/Model/Information/Link.as" />             <mx:Script source="import/Model/Information/Note.as" />              <mx:Script source="import/Model/Information/Person.as" />               <mx:Script source="import/Model/Information/Research.as" />              <mx:Script>              <![CDATA[             import Control.PIMController;             import Control.AppointmentController;             import Model.Information.Research;             import Model.Information.Person;             import Model.Information.Note;             import Model.Information.Link;             import Model.Information.Appointment;             import Model.DataManager;
fluen is offline   Reply With Quote
Old 06-11-2010, 10:18 PM   #8
Peter Cowling
quantum tunneler
 
Join Date: Sep 2008
Location: London, UK
Posts: 882
Default

The first question here is: what is in the as files?

But I would skip that conversation, and just read this. Note in section 4, where it talks about 'package'.

Okay, so that's the reverse of what you ask about, but I expect it'll provide the answer you want i.e. take a look through, make any changes to your as code, and then take a look at what you had at the start - where you where instantiating namespace defined components.
Peter Cowling is offline   Reply With Quote
Old 06-15-2010, 09:47 AM   #9
fluen
Registered User
 
Join Date: Apr 2010
Posts: 26
Default

Thank you for your answers!
I sovled the problem by importing in all my files.

In the mxml file

ActionScript Code:
import Model.DataManager; import Control.AppointmentController; import Control.PIMController;

In the control as file

ActionScript Code:
import View.PIM; import Model.DataManager;

And so forth...
fluen 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


All times are GMT. The time now is 11:15 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.