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

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / MultiCore Version / How to remove widgets previously loaded dynamically on: April 21, 2008, 01:49:11
I would like to know how would you remove the coolwidget dynamically that has been previously loaded into the WidgetCanvas.mxml when clicking on superwidget button prior to the super widget been loaded into the WidgetCanvas.mxml?

Currently you click the coolwidget button and the coolwidget is loaded into WidgetCanvas.mxml, if you click on the superwiget button a super widget is added to the WidgetCanvas.mxml. The WidgetCanvas nows contains both the cool and super widget buttons.

I want to remove any previous widget that is loaded to the WidgetCanvas.mxml before the new widget is loaded. What actionscript code will remove the previously loaded widget before the new widget is loaded to the WidgetCanvas.mxml.

This code is found on line: 46 of the coolWidgetMediator.as, what would the process be to do this dynamically?

:
// Handle clicks to the buttons added to the widget canvas
protected function onComponentClick( event:MouseEvent ):void
{
var component:DisplayObject = event.target as DisplayObject;
coolWidget.widgetShell.removeComponent( component );
component.removeEventListener( MouseEvent.CLICK, onComponentClick );
coolWidget.widgetShell.setStatusMessage( 'Removed CoolWidget-generated display object from Widget Canvas')
}

Wayne
2  PureMVC Manifold / MultiCore Version / Re: How do I add new custom components? on: April 15, 2008, 10:44:26
I would like to thank you very much. Testing with the debugger as suggested prior to making the camelCase change and then after has taught me tons.

The camelCase fixed the problem.

Kindly

Wayne

3  PureMVC Manifold / MultiCore Version / Re: How do I add new custom components? on: April 15, 2008, 04:04:47
Thank you , but I need alittle more help please. The page, ConfirmCanvas.mxml as canvas, I want to have load into the WidgetCanvas.mxml when the button is clicked , see code as follows. The MyPanel.mxml is based as a Panel which is then a view ie: xmlns:v.

:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:v="co.za.hrtrac.modules.confirmwidget.view.components.*" >

<v:MyPanel x="50" y="50"/>

</mx:Canvas>

Please show me how to code the protected function as per your previous posts example code. This is what I have done and this does not work. Have the following errors when I save the function in the widget mediator.
1046: Type not found or was not a complie-time constant:ConfirmCanvas

This is my code for the protected function in the mediator for the widget. ie: ConfirmWidget.mxml

:
protected function onProd( event:Event ):void
{
            // test panel created using actionscript
            var test:Panel = new Panel();         
            test.width = 400;
            test.height = 300;
            test.title='This is a tester';
            confirmTimesheet.widgetShell.addComponent( test );
           
            //this is for the custom component ConfirmCanvas.mxml
            var ConfirmCanvas:ConfirmCanvas = new ConfirmCanvas();         
            ConfirmCanvas.width = 400;
            ConfirmCanvas.height = 300;
            confirmTimesheet.widgetShell.addComponent( ConfirmCanvas );
}

I'm really stuck as to what I'm meant to do here. If I replace the following code as then all I'm doing is creating an actionscript canvas and not importing the ConfirmCanvas.mxml file as intended.

:
var ConfirmCanvas:ConfirmCanvas = new ConfirmCanvas();
with
var ConfirmCanvas:Canvas = new Canvas();

Thanks for your patience and appreciate your time.
4  PureMVC Manifold / MultiCore Version / Re: How do I add new custom components? on: April 13, 2008, 10:17:49
Cliff,

Thank you for your reply. I do managed to add a actionscript component but thos is what I would like to now please. See code extract as follows:

Current modularity code from CoolWidgetMediator.as line 32 which i assume is the function which adds the actionscript button to the stage:

protected function onProd( event:Event ):void
{
   // add a button to the canvas
   var button:Button = new Button();
   button.label = 'You prodded the Cool Widget! [ Click to Remove ]';
   button.addEventListener( MouseEvent.CLICK, onComponentClick );
   coolWidget.widgetShell.addComponent( button );
         
   // and add some status message text
   var message:String = "Some data from the CoolWidget Model: "+coolWidgetProxy.getData().toString()+ " ]";
         coolWidget.widgetShell.setStatusMessage( message );
         
}

What want to know is what is the code to add say YourName.mxml file to the stage by replacing the var button:Button = new Button() code that creates a new button on the stage?

I have the import path to the file in question, so its just how do I code this?

PS: This is what i had done to add a panel to the stage with actionscript.

protected function onProd( event:Event ):void
{
            var panel:Panel = new Panel();         
            panel.width = 400;
            panel.height = 300;
            panel.title='This is a tester';
            confirmTimesheet.widgetShell.addComponent( panel );
}

Thanks so much...
5  PureMVC Manifold / MultiCore Version / How do I add new custom components? on: April 07, 2008, 04:44:41
I have am really new to AS3 and even more so the Multiton framework.

The CoolWidgetMediator.as files create a button in AS3 code on line number: 33. What I did was add var panel:Panel = new Panel() just below the button script and called coolWidget.widgetShell.addComponent( panel ) to create the object.

This works perfectly as I click the CoolWidget button in the application bar both the button and the panel are added to the widgetshell.

My question is how do I add an mxml file (container canvas) which contains my custom components? I have created  a new mxml file under the Coolwidget view. New to AS3 so I dont know how add this mxml file eg:confirmCanvas.mxml to the shellwidget when the button is clicked. As mentioned above I coded the panel using AS3 which works with my test.

Im going to have numerous components which I will have to add to the shellwidget when the user clicks single a button. The idea was to add confirmCanvas.mxml with its custom components inside the confirmCanvas.mxml to the shellwidget.

Thanks, Wayne
6  PureMVC Manifold / MultiCore Version / Modularity string name on: March 13, 2008, 11:06:33
I would like to know what is the string name=Modularity importance and how they work together?

1. In the Modularity.mxml which is set as a constant .
2. In the ApplicationFacade.as the name "Modularity is set in the startup function. Does the name in the mxml file tie up with this. Is the name Modularity due the the folder name modularity under your org folder?
3. In the starupCommand.as the name Modularity is set in the excute function as well. Does the var app: Modularity name refer from the ApplicationFacade.as. ?

Secondly the root folder names are org and com respectively. I would like to ask how I would setup my project root when I using a domain name as root folder co.za.'myDomain to contain the sub folders for the canvasWidgets (your root folder org). What do I name the the root folder for the multitons when I have already used the co.za.'myDomain name?

Do I have to use a second domain name as you have eg: com.widgetmakers? What would yur advise be?

PS. We are now upgrading a long standing web based enterprise software package built in CF 7 to use the new framework. We congratulate you and your team on a job well done.
Pages: [1]