Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Trouble with view components - mad stuck  (Read 11349 times)
Dal
Jr. Member
**
Posts: 16


View Profile Email
« on: June 12, 2008, 07:36:16 »

Hi Guys,
Hope all is well within the land of MVC, having lots of fun with a website I am making in flash using pureMVC framework at the moment :)

I am however having a little bit of trouble with a revolving image box I made in pureMVC.
Essentially I am just reading in a XML file which has a list of images, a mediator is created for every image, that image get loaded into the view component automatically in the constructor, and all of these mediators are linked to master mediator.

The master mediator controls the fading in and out event, tells which mediator to do what - which in turn controls the view component of the image.

Everything is cool, and this seems to work fine - unless we add more than 20 images to the list.......
20 seems to be the magic number I do not understand why?

I thought that perhaps it maybe because all the images are automatically loaded in, the mediators are created one after the other, leaving only a couple of Millie seconds between each mediator / image load that this may cause some issues?

Would this be the case?
Can you suggest a better way for a noob to go about this?


Cheers
~D
Logged
Larry Marburger
Newbie
*
Posts: 2


View Profile WWW Email
« Reply #1 on: June 13, 2008, 03:25:55 »

Is there a reason you're using a separate mediator for each image?

I don't know how you're app is laid out, but I would remove that layer of abstraction.  Create a single mediator that directly controls each image view component.  It would be responsible for transitioning between individual images, adding and removing images from the display list, and whatever else your app does.

I haven't experienced the "20" issue before, but perhaps if you remove the 2nd level mediator complexity, it'll "solve" that issue.
Logged
Dal
Jr. Member
**
Posts: 16


View Profile Email
« Reply #2 on: June 13, 2008, 04:41:38 »

Hey man,

I gave it a level of abstraction so that I could easily extend the imageMediator if I wanted to add more functionality, such as using paper vision 3d on each image so it is aware of its x y z and encapsulated within is own mediator.
It also reduced the notifications interests in half ( down to maybe 6, with more to be added later ), and clearly separates tweens. ie. moving a single image and moving the whole set of images - allowing me to funk-ify the transitions between each image.

I'll give that a shot though and see what happens.


Cheers
~D
Logged
creynders
Jr. Member
**
Posts: 18


View Profile Email
« Reply #3 on: June 16, 2008, 04:23:43 »

Sounds like you have the right reasons to have the image mediators, so I wouldn't drop that. My guess would be that the problem lies in how the mediators are instantiated. What way do you differentiate between the instances? Do you have a factory class, which keeps track of the various instances or ... ?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: June 16, 2008, 08:00:27 »

There should be no 'ceiling' other than what your processor can cope with for Mediators. Certainly not '20'. Unless you happen to be running, say, a Commodore 64.  :)

Have a look at the HelloFlash demo. It generates a trail of moving squares and an associated mediators as you drag a square. You can drag all day before noticing any performance degradation. It also demonstrates a way of managing the naming for a Mediator that is instanced multiple times.

-=Cliff>
Logged
Dal
Jr. Member
**
Posts: 16


View Profile Email
« Reply #5 on: July 01, 2008, 05:07:55 »

Hi Guys,
Thanks for the help - I actually just put a slight delay on the file that loads the images.
Gives it a slight break in between calling the load image class, giving half a second between calls.

In terms of having the one mediator instanced, I send in a the page name, then a uniq image name to make the individual mediator name.
It seems to work pretty well - but in terms of a gallery, it means I have to keep an array of the thumbs in the gallery mediator that can get returned via custom call, I couldn't really think of a better way.....

Anyways Thanks guys.
Logged
Pages: [1]
Print