Actionscript 3 :: Adding Elements In Flex Using Presentation Model

Apr 11, 2011

I'm refactoring some Flex code written by another developer and I'm implementing a PresentationModel approach, as I like to separate out the ActionScript from the MXML. One of the problems I've found is that the original ActionScript code adds/removes elements from the MXML.What happens is the handler function checks the model and if the values are correct will either create or remove a element from the view. What is the best way to get the presentation model to ad elements to the view and still keep this loose coupling that I'm aiming for.I was thinking of using simple events which the presentation model dispatches and a view can list for passing the details of the element to add.

View 2 Replies


Similar Posts:


Flash :: Silverlight - MVVM - Presentation Model In Flex Vs Presentation Model In Silverlight: Advantages And Disadvantages?

Apr 10, 2011

As it is said here: [URL] "If you do a Google search today for "MVVM and Flex", the first post is by somebody who claims that MVVM is not a good fit for Flex. I couldn't disagree more. Out of the box, the Flex framework makes it much easier to implement a Presentation Model than similar MVVM implementations in Silverlight. That is not to say that there aren't good third-party libraries that make it easier in Silverlight, but without any help, it is easier to do in Flex." So MVVM as LOGICAL CONCEPT can be implemented in both but the way it is implemented in Silverlight requires more Plumbing than Flex.

What prevents Silverlight MVVM to be implemented like Flex ? Doesn't Silverlight have same capability in event system to do the same? If yes why does Silverlight do things more complicated what's the advantages then ? Is it about using Class Interfaces which are more strongly typed? What are the disadvantages also ? For example as for implementing MULTIPLE VIEWS for 1 View-Model does Flex implementation make it also more obvious?

View 2 Replies

Flex :: DTO / VO Versus Presentation Model

May 5, 2011

In Flex world, is DTO / VO same as Presentation Model?

View 2 Replies

Flex :: Cairngorm 3 Presentation Model Initializations?

Jul 13, 2011

I have a TitleWindow that I open up... and I have 6 states defined.I am using the Presentation model pattern for all of my views. When I tell my window to go to XXX state, the controls have to initialize since the states in flex use lazy loading. so... my PM code that says myTextArea.text bombs out and say "cannot access..." so as a work around, I made some creationComplete events on my controls to register the control with the PM. So when the state changes, the textarea finally initializes and on creationComplete calls PM.registerTextArea() which sets a reference to it. then in that function I run my code... myTextArea.text.. etc.

This seems like such a ugly hack that I hate it. Is there any way to wait until the entire state in created then call code on the PM? I have tried enterstate... but this event seems to fire before the state controls are ready.I tried to add a comment, but I guess editing is the only way I can do this...I am doing something slightly off straight PM. Every view has a viewController (as I call them). Its kinda my own hybrid of a delegate / dataprovider. But this is moot. It's the flex component lifecycle when dealing with states that is the pain.if you change state.. there is no event to say "all my components in this state are ready".only event to say "we changed state". so my code that fires on state change is trying to talk to components that aren't ready yet.So from what I see, there seems to be no design pattern or perfect way to ensure that all components are created in a state unless using creationComplete on every component in the state to register it is ready... if you don't, you get a race condition. Regardless of frameworks or design patterns, this seems to be a root issue.

I am trying to attach video to a display once I get to that state. This is done via addchild. regardless of where I do it.. I need to know that the videoDisplay is done loading before I call addchild. I even tried currentStateChange event since docs say that fires last... but alas.. the components in the state are still initializing. So it seems that creationComplete is my only option. Maybe the only sane way to keep to clean code is to create the entire thing(videodisplay and video) using as once the state is entered. I just hoped the flex framework had events to ehlp me here rather than buiilding everything on the fly in as.

View 1 Replies

Flex :: Presentation Model Pattern Can View Specific Logic Reside In View?

Aug 15, 2011

I'm currently using RobotLegs with the Presentation Model pattern to develop a Flex 4 project. I understand that all business logic related to a View resides in the Presentation Model associated with that view, however, I am confused when it comes to View specific logic.For example, I have an indicator that needs to be positioned relatively to list items depending on which list item is selected. Is it acceptable in the Presentation pattern to put the logic that will position the indicator in the View and simply have that logic run in reaction to a selectedIndex property changing in the presentation model?The reason I am considering this is that since the Presentation Model does not have a reference to the view it is difficult to come up with an ideal solution for manipulating view components.

View 1 Replies

Flex :: Papervision - Interactive (Adding Listeners To) DAE Model

Dec 2, 2010

I have a DAE model that is parsed into several parts. I am able to deal with them separately, such as changing their material or colour but I am having problems adding click or hover listeners over the children. For example, lets say I have a model of a kitty where each facial feature is a child. I want to be able to hover or click the features and have a window pop up explaining the feature. I've tried parsing the model and adding listeners but it doesn't seem to work.

View 1 Replies

Flash :: IDE - Presentation To Work With Kensington - Model # 33374

Dec 2, 2009

i have a client that uses Kensington model # 33374 how can i program the flash presentation to work with it?

View 3 Replies

Flex :: Adding Custom Elements To Charts

Nov 18, 2010

If you see google finance or other such charts, they usually have a small pentagon on the chart that indicates when the dividend was paid. Note the D markers in the screenshot [URL]. In this link you will see A,B,C,D .... along the charts X-Axis. If you choose a larger data range say 2005- 2010 , then you will see blue dividend markers along the x-Axis. Is there any thing in Flex that will allow us to do that?

View 1 Replies

ActionScript 2.0 :: Adding Sound In Presentation?

Dec 17, 2003

i have a presentation and i have more then 1 scene is there a way to have music playing thoughout them all?

View 1 Replies

ActionScript 3.0 :: Adding Elements To An ArrayCollection?

May 29, 2009

I am having issues with this method. It's supposed to loop through stage elements (news feed) and check if the item is checked/enabled. If they are, it should add them into an array ratingAC, which will keep track of the number of elements that are rated, and the rating total. The problem I am having is that only one item is added to the total even if multiple are selected.
 
Archive Vars......
[Bindable]
public var newsDB:ArrayCollection = mx.core.Application.application.newsDB as ArrayCollection;

[Code]....

View 13 Replies

ActionScript 3.0 :: Adding Elements To An XML List?

Mar 21, 2010

I have 2 arrays, one of images, the other of links  I would like to create an XML list using the values in these arrays.  My code is similar to:

public function savecards():void  var coverflow:XML = new XML(<coverflow/>); var cover:XML = new XML(<cover/>);
for (var j:Number = 0; j < 2;

[code].....

View 2 Replies

ActionScript 2.0 :: Adding The Value Of Array Elements Together?

Feb 20, 2007

i have a clip on the stage that is 650px wide. i am placing dynamicaly sized clips on top of that clip. when they are created, their names are placed into an array. I am trying to take the items out of the array, find their widths, and then figure out if the width will be greater than 650 if the next clip is placed down. i'm stuck on the loop.

("track1Clips" is the array i have the clips in) here's what i have
for (i=0; i<_root.track1Clips.length; i++) {
clipName = _root.track1Clips[i];

[code].....

View 3 Replies

IDE :: Adding Gap Between Elements In A TileList Component?

May 12, 2010

Pff is there a way to add padding between elements in a TileList

View 1 Replies

ActionScript 2.0 :: Best Practices For Adding / Removing Elements?

Mar 7, 2006

I thought i'd start this thread to uncover peoples habits and practices when it comes to the simple operation of adding and removing elements on stage. I ask because there are so many alternatives, and I keep wondering what might be the best/most eficcient way of doing it. Let me explain by giving an example:

Your user has chosen to click that flashing button that says "Sign up for our mailing list" and you need to prompt the user for a valid e-mail address by presenting him/her with an alert box on top of everything else. Do you.[code]....

View 3 Replies

ActionScript 2.0 :: [flash8] Array - Adding Elements TOGETHER

May 2, 2008

Basically i've got a timer which records how long a user remains in either section A,B or C on my site. Each time the user switches from say A to C, the time spent in the section A is recorded into Array A and so forth. What i'm having difficulty with is adding each of the elements within the array together..... Top bits are just the button functions....bit in bold is what i would THINK would be the correct way to add the elements together - with a for loop....

[Code]...

View 1 Replies

ActionScript 2.0 :: [MX2004] Adding Elements To Array?

May 5, 2005

When I simply add an element (jpeg) to an array it wont show when previewing, even though it gets traced.Here's the deal:

Code:
this.pathToPeople = "images/photo/people/";
this.peopleArray = ["1_people.jpg", "bas1.jpg", "2_people.jpg", "3_people.jpg",

[code].....

View 14 Replies

Flex :: Callback To Model Object?

Jul 23, 2010

I am trying to figure out how to define a callback to my model object, via the Mate Frameworks LocalEventMap.

<EventHandlers type="{WebServiceEvent.RT_GET}" debug="true">
<HTTPServiceInvoker url="/services/rtGet.asp">
<resultHandlers>

[Code]....

I get essentially the same error if I try to make method="model.rtGetHandleResult"

So, in keeping with the presentation model... how do I have the event map get this to the model to execute?

View 2 Replies

Flex :: Store The Model Of An Application?

Apr 25, 2011

I am working on an StoryBoarding application,it is a slide based application in which the authors can put several components like image , sound , captions etc in each of the slide.A collection of slides will make a storyboard.This application will be deployed on a web server (sharepoint + IIS , and php+apache), and several users can collaborate with each other for authoring or reviewing the storyboard.In my application I also want to support auto save ,which will keep on storing the state of the storyboard.User can also save at any point of time by clicking the save button.I am confused about how to store the state of the storyboard.

1)Presently I am doing this by passing all the storyboard data to a dot net web-service and then that service is storing images,caption etc in their respective tables into a database .2)Another approach possible is to store the model of the application as a serialized object into the db , which will be more convenient since separating the components of the model (like images,captions etc..) will not be required and also restoring the state of the objects in the application will be easy . I have two doubts about using approach 2 :-i) I want the the saved storyboard to load quickly, for which I would like to support the partial so that lighter objects like caption can be loaded quickly but other heavier objects like image,video etc can be loaded on demand. Using approach 2 , do I have to send the whole data in one go or is there way to support partial loading ?

View 1 Replies

Flex :: Bind XMLListCollection Into Model?

Mar 24, 2012

When the XMLListCollection is updated in the DataGrid, I want it to add the XML (bind it) into the Model. How would I do this? Or if not possible, how would I manually add XML into the Model?

This is a rough example of what I'm trying to do. Adding data to the DataGrid works fine; it just doesn't go into the Model when sending to the HTTPService.

<mx:Model id="model">
<root><colors>{collection}</colors></root>
</mx:Model>
<mx:XMLListCollection id="collection" />

[Code]....

View 1 Replies

Flex :: Performance - Why Does Use A Single Threaded Model

Jul 10, 2009

Over the past few weeks I have been building a prototype application using a Flex front end connected to a J2EE backend using blazeDS. The prototype is an experiment to learn flex and see what its suitability is for a complex trading application requiring a large number of dynamic updates (i.e > 20 a second) via a pub sub type model. During some lightweight performance tests it's become apparent that I need to use multiple threads to ensure the UI remains stable when receiving a large number of updates from the server. All was going well until I discovered that flex has a single threaded programming model!

From a quick Google it looks as though there are numerous hacks to implement thread like behavior. I am sure many people must have been faced with a similar problem. Can people let me know: Are there any good threading libs that are well maintained etc Do other RIA technologies such as silverlight have the same problems. Why did abobe implement a single thread model? Are there any other tricks I can use to ensure my UI is stable.

View 7 Replies

Flex :: Zend Framework Model With Service?

Feb 10, 2010

i have a question about Zend Framework and mainly the model part. I know there is no abstract model class and understand why. I red a lot of blog posts about it, but couldn't find any example that would clearly explain it to me. I'm building a very basic application. Lets imagine we have just three tables.company(ID, name, street, streetNo, Town), meta(ID, name, description), company2meta(ID, companyID, metaID, value, note). All types of realtionship are there (1n n1, nm). The a need also services (amf) with Value Objects. So, here is what I think:

[Code]...

View 1 Replies

Flex :: Back PopUp (Dialog) With A Model

Mar 9, 2010

I'm using MATE on an Adobe Flex project for MVC. On one of our pages, we have a dialog window that is presented to the user that displays them information that comes from RPC. The pages where this dialog pops up is unrelated to the data being displayed so this is a separate model. How do I create a MATE mapping file that will create the dialog window, make it visible to the user, and then inject in data from a model?

View 1 Replies

Flex :: Adobe Prevent Model Tainting?

Mar 29, 2011

I have some values stores in my model. I need to create a copy of those values, make some changes, and then output those changes without affecting the model values.

var my_source:Array = model.something.source
var output:Array = new Array();
for each (var vo:my_vo in my_source) {

[code].....

View 2 Replies

Flex :: One Data Model Multiple Platforms Different UI?

Jul 3, 2011

I have designed "the core" of the application i am working on ( it communication with the server, data processing, etc. ), and now i am a bit stuck on the User Interface, because i wish it to be specific, and probably different on the different platforms it goin to run on ( PC, tablet, gsm ).

My question basically is How to separate the "core" of the application, which must remain the same for all of the platforms, from the UI's which shall be very different applications ?

View 1 Replies

Flex - Cairngorm Model Locator Pattern?

Jul 5, 2011

In Cairngorm (Flex Framework), there is Model Locator Pattern, which is similar to Global variables, is it a right pattern, Adobe is saying for flex its best pattern

[Code]...

View 1 Replies

Flex :: Communicate Between The Skin And The Data Model?

Dec 2, 2011

How to send to the skin some value which have changed?

View 1 Replies

Flex :: Update The Model Without Losing Focus In Datagrid?

Jan 25, 2010

In my Flex Project using Cairngorm, I have a model that stores a bindable ArrayCollection displayed by a DataGrid. My problem occurs when the model is updated by the responder (from a Java service, after an "update" event), because the focus located in a cell of the DataGrid is lost (the scroll position il also lost). So, I retrieve the position before the update, with DataGridEvent.ITEM_FOCUS_IN event :

myModel.focusedCell.rowIndex = e.rowIndex;
myModel.focusedCell.columnIndex = e.columnIndex;

But, from where restore these parameters ? How to trigger this update only when the model is updated ?

View 1 Replies

Flex :: Single Model - Multiple Filtered Views

May 17, 2010

I have data model (dataProvider as ArrayCollection) i want to display in few views , each view should show filtered data. As you probably know, filterFunction is property of ArrayCollection,so I can't use this solution (unless creating new instance of ArrayCollection for each view on top original and impementing filterFunction).

View 2 Replies

Flex :: Injecting A Specific Model Implementation On The Fly [Robotlegs]?

Jul 25, 2011

Is model injection on the fly possible? In other words,if I ask for a model of the type IPhotoModel, I should get one of its implementations based on the current state of the view. If I am looking at a UserPage,I should get a user-specific implementation of that model.I am looking at a LocationPage,I should get a location-specific implementation.Currently, the only way that I see is introducing a command that specifies the model mapping, with a concrete one based on the current view state ...

injector.mapValue(IPhotoViewModel, injector.getInstance(UserPhotoViewModel)) or
injector.mapValue(IPhotoViewModel, injector.getInstance(LocationPhotoViewModel))

is this the best way possible? I do not really want to introduce much coupling logic outside of the context, but ...

View 1 Replies

Flex :: Create An Hierarchy (not Tree Model) Representation?

Jan 24, 2012

I have some data in collection from which i have to create hierarchy diagram in Flex.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved