Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Problem accessing public function in another module

karanaso
Level 1
Level 1
Hi there,



I have only started working with Flex 3 only couple of days
ago. I am a Delphi experienced programmer if that helps.

I have created a small Flex Project which contains 3 Flex
modules. The modules are not loaded as SWF files but with the
<local:......>.



My modules are data-aware and they work fine on the first
change state. I am also able to update my data by pressing a
button.



I have two big problems I hope you gurus could help me.

1. Is it possible to access a public function written in a
different module ? (Once again I state that I load the modules
using the <local:formname/>

2. Is it possible to execute an action when I change the
currentState because my script only fires only with the
creationComplete which triggers the first time.



my module code looks like

<mx:Module xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" width="780" height="560"
creationComplete="doInit()" >



public function doInit():void

{

Alert.show('hi');

rs = new HTTPService;

rs.url=myurl;

rs.method="POST";

rs.addEventListener("result",resultHandler);

rs.addEventListener("fault",faultHandler);

rs.send();



}



...

..

..

..

</mx:Module>



Thank you all guys and really really sry for being such a
n00b 😞 😞 😞 🙂 :(:(:(

Sotiris/Greece
0 Replies
atta707
Level 2
Level 2
have you tried



<local:formname id="fn"/>



and then in your script this.fn.doInit() should work!



Do you have the event on which you're chaning the
currentState? If so, that would be place to add more logic.



For a more graceful solution of the latter take a look at the
enterState and exitState event of the State class.



By the way, are you sure why are you using 'modules' versus
custom components here?



ATTA
karanaso
Level 1
Level 1
Hi again,



First of all let me thank you for taking you time with me...

I tried the id-thing unsuccesfully, I have uploaded my source
at mywebsite (
http://www.sekdev.com/test/Ermineia.rar)
I hope you could take a look. Having said that 🙂 🙂 could you
plese provide with an example of how this.func() would work on
seperate states. Or an example how I can fire an event on change
state within the different module or how from the mail application
I can fire a function that resides within a module.



Feeling stup.....id at 32 is a really bad feeling man 🙂 🙂

Plz help and thx again 🙂



Sotiris/Greece