View Full Version : How connect .mxml with .as?
fluen
06-11-2010, 10:43 AM
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!
http://hold3lg6.files.wordpress.com/2010/06/mvc-error.png
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! :D
manish_raj
06-11-2010, 11:40 AM
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” />
fluen
06-11-2010, 02:11 PM
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.
<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;
box86rowh
06-11-2010, 05:32 PM
dont nest the script tags, and the paths in the source attribute are file paths, not package paths,
<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;
fluen
06-11-2010, 08:02 PM
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 :D
<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
06-11-2010, 08:08 PM
Also tried this:
<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
06-11-2010, 09:29 PM
I have also tried this with no luck. Any help shall be appreciated
<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;
Peter Cowling
06-11-2010, 10:18 PM
The first question here is: what is in the as files?
But I would skip that conversation, and just read this (http://www.insideria.com/2010/05/moving-your-flex-components-fr.html). 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.
fluen
06-15-2010, 09:47 AM
Thank you for your answers!
I sovled the problem by importing in all my files.
In the mxml file
import Model.DataManager;
import Control.AppointmentController;
import Control.PIMController;
In the control as file
import View.PIM;
import Model.DataManager;
And so forth... :D
|
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.