Didn't seem to run for me.
Anyway, the code you sent is not a Module but a Application. Modules are a similar but different concept. Note that if this application gets loaded into another application you wlll get errors because Application.application is always the first application that is loaded (main.swf). Use 'this' or 'document' to maintain document local parameters. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of shawn.gibson Sent: Sunday, July 08, 2007 3:53 AM To: [email protected] Subject: [flexcomponents] Re: "Property leftCan not found on Main and there is no default value" Thanks Alex. They're definitely there, though maybe I'm doing it wrong. I figured I'd make a working example all in one file to show what I mean, sorry if my server is slow, it's a temp server till mine is back from the shop: http://faceitphoto.ca/modules/Inline.html <http://faceitphoto.ca/modules/Inline.html> Basically, anything in the bordered box is meant to be the <shawn:myModule> sort of thing (right now it's just an mx:Canvas). The buttons on the ApplicationBar are meant to reside in the Main app, while the Canvas is meant to be a generic module that can finction as my initial container for all of the potentially dozens og possibilities it will have. I would like to be able to set the init properties of each inner canvas, i.e., the left, right and bottom ones, per Module, as for example sometimes you won't want to load the bottom canvas (i.e. it will = 0% for both percentWidth and percentHeight...same with the left canvas. Maybe an Admin console for a particular area will be only one big canvas, which means setting the right to 100% and 100$, and the other canvasses to 0%...that sort of thing...). If it makes more sense, here is the reason I'm doing it, if you look at the MenuBar at the following link, you can see that there are going to be many different types of content potentially loaded: http://mygallerysite.net/mech2/Main.html <http://mygallerysite.net/mech2/Main.html> The only thing that works there right now is the Main>Home and the 2 galleries (mine and Marketa's) under Galleries>View Galleries. If you look at the galleries, this shawn:myModule thing makes sense because if someone loads a landscape image, they may want to stretch the width, if they load a portrait, they may want to stretch the height...t's still very early, I have a lot to learn, but this is one aspect I better nip quickly because not only does it (creating a shawn:myModule component) give my Modules a chance, it will also help me solve a lot of errors I'm getting in general. I have a feeling I'm going to have to learn how to write packages and Classes and that sort of thing for this project to work...including this aspect. When done, the canvasses will actually use the zoom instead of disappearing, but I am not at the point where I want to get the code muddied with yet, as I'm not sure how to implement it... Any suggestions as to why the errors come up when the button code is stripped from the main app (Inline.html in this case) and the canvasses are put into a module, and the buttons in the housing app? Thanks kindly, Shawn ps just in case I move this file, or myserver doesn't work, I'll include the one app that's meant to strip into a Main app with the buttons and a ModuleLoader for the canvas area: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute" xmlns:ns1="http://code.google.com/p/flexlib/ <http://code.google.com/p/flexlib/> " creationComplete="initFrames();"> <mx:Script> <![CDATA[ //import mx.events.ModuleEvent; //import mx.modules.*; import mx.core.Application; //import mx.events.ModuleEvent; public function initFrames():void{ Application.application.leftCan.percentWidth=25 Application.application.leftCan.percentHeight=80 Application.application.rightCan.percentWidth=75; Application.application.rightCan.percentHeight=80; Application.application.bottomCan.percentWidth=100 Application.application.bottomCan.percentHeight=20 downButClosed.enabled=true; leftButClosed.enabled=true; expandAllBut.enabled=true; resetBut.enabled=false; } public function shrinkLeft():void{ Application.application.leftCan.percentWidth=0; Application.application.rightCan.percentWidth=100; downButClosed.enabled=false; leftButClosed.enabled=false; expandAllBut.enabled=false; resetBut.enabled=true; }; public function shrinkBottom():void { Application.application.bottomCan.percentWidth=25 Application.application.rightCan.percentHeight=100; downButClosed.enabled=false; leftButClosed.enabled=false; expandAllBut.enabled=false; resetBut.enabled=true; }; public function shrinkAll():void { Application.application.leftCan.percentWidth=0; Application.application.leftCan.percentHeight=0; Application.application.bottomCan.percentWidth=0; Application.application.bottomCan.percentHeight=0; Application.application.rightCan.percentHeight=100; Application.application.rightCan.percentWidth=100; downButClosed.enabled=false; leftButClosed.enabled=false; expandAllBut.enabled=false; resetBut.enabled=true; //expandAllBut.enabled=true; }; ]]> </mx:Script> <mx:ApplicationControlBar width="100%" top="0" dock="false" horizontalCenter="0"> <mx:Button width="15" height="15" click="shrinkAll();" id="expandAllBut" upSkin="@Embed('assets/myButtonAssets/expandall.swf')"> <mx:disabledSkin>@Embed('assets/myButtonAssets/expandalldisabled.swf')</ mx:disabledSkin> <mx:downSkin>@Embed('assets/myButtonAssets/expandalldown.swf')</mx:downS kin> <mx:overSkin>@Embed('assets/myButtonAssets/expandallover.swf')</mx:overS kin> </mx:Button> <mx:Button width="15" height="15" click="shrinkLeft();" cornerRadius="0" id="leftButClosed"> <mx:disabledSkin>@Embed('assets/myButtonAssets/expandleftdisabled.swf')< /mx:disabledSkin> <mx:overSkin>@Embed('assets/myButtonAssets/expandleftover.swf')</mx:over Skin> <mx:downSkin>@Embed('assets/myButtonAssets/expandleftdown.swf')</mx:down Skin> <mx:upSkin>@Embed('assets/myButtonAssets/expandleft.swf')</mx:upSkin> </mx:Button> <mx:Button width="15" height="15" click="shrinkBottom();" cornerRadius="0" id="downButClosed"> <mx:disabledSkin>@Embed('assets/myButtonAssets/expanddowndisabled.swf')< /mx:disabledSkin> <mx:downSkin>@Embed('assets/myButtonAssets/expanddowndown.swf')</mx:down Skin> <mx:overSkin>@Embed('assets/myButtonAssets/expanddownover.swf')</mx:over Skin> <mx:upSkin>@Embed('assets/myButtonAssets/expanddown.swf')</mx:upSkin> </mx:Button> <mx:Button width="15" height="15" click="initFrames();" id="resetBut" upSkin="@Embed('assets/myButtonAssets/xtract.swf')"> <mx:disabledSkin>@Embed('assets/myButtonAssets/xtractdisabled.swf')</mx: disabledSkin> <mx:downSkin>@Embed('assets/myButtonAssets/xtractdown.swf')</mx:downSkin > <mx:overSkin>@Embed('assets/myButtonAssets/xtractover.swf')</mx:overSkin > </mx:Button> </mx:ApplicationControlBar> <mx:Canvas width="95%" bottom="5" horizontalCenter="0" height="87%" borderStyle="solid" borderThickness="2" borderColor="#000000"> <mx:Canvas width="25%" height="80%" left="0" top="0" id="leftCan" backgroundColor="#c0c0c0"> </mx:Canvas> <mx:Canvas width="75%" height="80%" right="0" top="0" id="rightCan" backgroundColor="#ffffff"> </mx:Canvas> <mx:Canvas width="100%" height="20%" id="bottomCan" x="0" bottom="0" backgroundColor="#eaeaea"> <mx:Button label="Button" width="10" height="100%" right="0" verticalCenter="0"/> </mx:Canvas> </mx:Canvas> </mx:Application>
