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: dynamic instantiation  (Read 6198 times)
eball
Jr. Member
**
Posts: 15


View Profile Email
« on: February 15, 2009, 11:56:26 »

I am using the superPanel utility with an associated mediator to handle some sizing issues.
When I add an instance of superPanel via mxml, everything work fine:
:
xmlns:sh="shell.view.components.*"...
<sh:SuperPanel id="superPanel" title="SuperPanel 01"
x="0" y="0" width="345" height="180"
layout="absolute" showControls="true" enableResize="true" >
<mx:Label text="asfd" />
</sh:SuperPanel>

When I add instances dynamically:
:
var newPanel:SuperPanel = new SuperPanel;
container.addChild(newPanel)
... the class is instantiated, I can visually see the new instance of SuperPanel, and the SuperPanelMediator loads..... however, although the mediator loads, it doesn't run the "onRegister" method, or "listNotificationInterests" etc.

Without this, the mediator functionality (ie: notifications regarding the sizing functionality) does not work.
Please help.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 16, 2009, 06:07:46 »

Is it possible yor are not giving each mediator a unique name? If you instantiate a mediator more than once then you can't use a handy NAME constant for its name, you must generate a unique name. See the HelloFlash demo for a Mediator that does this.

-=Cliff> 
Logged
eball
Jr. Member
**
Posts: 15


View Profile Email
« Reply #2 on: February 17, 2009, 01:40:54 »

Wow, thanks!
That was giving me all sorts of grief!!!

Quick question. Does it matter where I register the new instance of SuperPanel. Right now i have it in my "AddPanelCommand.as", which creates a new instance, sets its properties, registers it, then send it out with a notification. is that right?
:
var panel:SuperPanel = createSuperPanel(note.getBody().url);
registerMediator(new SuperPanelMediator(panel));
sendNotification(PANEL_CREATED, panel);
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #3 on: February 17, 2009, 01:51:12 »

offtopic...
Which SuperPanel are you using? The constructor looks like the 'old' one.

http://brandonmeyer.net/blog/?p=7
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
eball
Jr. Member
**
Posts: 15


View Profile Email
« Reply #4 on: February 17, 2009, 02:49:45 »

I am using: SuperPanel version : 1.5 author  : Wietse Veenstra

It is a good utility, but had some limitations. I was altering the code to increase some of its functionality.

Your SuperPanel 1.3 look great and appears to be a bit further along.
I think when your panel is in maximized mode, it should auto expand with it wrapper. (one of the things i added to the one i am working with)
Also, i agree that a taskbar or tabbed bar should manage all the opened taskbars when minimized or in maximized mode. That was going to be one of my next tasks.
Your "TODOs" look like they will add some nice functionality to the panel.
Maybe after I get some time, I will rework my project to use your SuperPanel, especially if you add your updates.
Thanks.
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #5 on: February 17, 2009, 02:57:36 »

That actually isn't mine, but it is a 'live' project compared to the other. I've used Wietse's for some time, and it is very functional too after it is tweaked to allow styling.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
eball
Jr. Member
**
Posts: 15


View Profile Email
« Reply #6 on: February 17, 2009, 04:19:00 »

Like I said, Wietse's it is a good component. Not trying to step on anyones toes.
Just saying the other one seems to be closer to being a completed comp.
Logged
Pages: [1]
Print