header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
krntom
Points:40
Posts:0
Answered

6/15/2010 3:42:55 AM

Title: (flex) Passing String To Module


Hi All,

I try to passing string to flex module with these code, but not succesfully working
Could someone give me such suggesstion. Thanks





--------
.
.
            public function initApp():void {  
                info = ModuleManager.getModule("Module1.swf");  
                info.addEventListener(ModuleEvent.READY,  
                    modEventHandler);  
                info.load();  
            }  

            private function modEventHandler(e:ModuleEvent):void  
            {  
                sm = info.factory.create() as Module1;  
                vb1.addChild(info.factory.create() as Module1);
            }  
            
            public function st():void {
            	sm.Info("test");
        }
        ]]>  
  
    </mx:Script>  
    <mx:VBox id="vb1" width="100%" height="100%">  
        <mx:Panel width="250" height="200" layout="absolute">
            <mx:Button label="Button" x="10" y="10" click="st()"/>
        </mx:Panel>
    </mx:VBox>  
.
.
=========

=========
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300">
      <mx:Script>
        <![CDATA[
		[Bindable]
        private var s2:String;
            public function Info(s:String) {
            	s2=s;
            	label01.text=s2;
            }
        ]]>
    </mx:Script>
    <mx:Label id="label01" x="68" y="57" text="original"/>
</mx:Module>
==========




1
Davis
Points: 740
Posts:0
6/15/2010 4:22:02 AM



to access the function inside the module you need to use child property. See if this works:
sm.child.Info("test");

ping me back if does not work

2
Brad
Points: 750
Posts:0
6/15/2010 4:32:58 AM



you can use the following code to access the public function inside the module


//vb1 is your container in which module is added 
public function st():void { 
                vb1.getChildAt(0).Info("test");  
    }  


3
krntom
Points: 40
Posts:0
6/15/2010 5:01:44 AM



the tips doesn't work yet..
anyway thank you for resposes.
i will summarize then after find the solution.

4
krntom
Points: 40
Posts:0
Accepted Answer
6/15/2010 5:55:59 AM



i'm using other technique to passing the string, taken from adobe flex livedocs,

<http://livedocs.adobe.com/flex/3/html/help.html?content=modular_5.html>

or referencing module variable to parent variable.

something like :

label01.text = parentApplication.definedtext;

thank you all, case closed.


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 4+1 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions