Yes, I did change that already it does say returnEmail on both sides
now.

 

Very interesting...  

 

This would be a better question then...  

 

I've got a login.mxml file which controls the different states the login
can be in.  Each state essentially is another mxml file.  I'm calling a
CFC function to process the login which is in the loginForm.mxml.  This
function has the email address and name as returned by the CFC.  How can
I pull that information out and into the login.mxml file?  So if what
you are saying is that each of the files are their own class, I would
need a way to call that class from another class.

 

I did change that method to be public but still wasn't able to "see" it.
What is the syntax to access an external class from another class?  Do I
need to reference class.function()?

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Saturday, July 12, 2008 12:34 AM
To: flexcoders@yahoogroups.com
Subject: {Disarmed} RE: [flexcoders] Calling AS3 functions

 

Each mxml has its own (document) scope.  It essentially defines a class.
A method must be public in order to be accessed from outside the class,
you cannot access protected from outside the class.

 

Your snippet doesn't have id's or show the relationship between the two
classes so it is hard to say why it isn't working. Also, you appear to
be trying to call returnEmail when the snippet only showed a returnName
method.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott
Sent: Friday, July 11, 2008 8:30 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Calling AS3 functions

 

I'm still getting the same error...

 

The class exists in the loginForm.mxml but the mxml code exists in the
login.mxml file.

 

Is there something special I have to do to use the functions that exist
in the other mxml file?

 

Better yet, is there a way to access variables other than setting up a
function in the active script?

 

 Thanks much.

 

-----------


All AS code needs to be inside the curly braces and you need to
concatenate your static string to the string returned from your function

<mx:Text text="{returnEmail() + ' is logged on'}" /> 

 

--------------

 

I'm working on a logon class in Flex 3.  I've got a login.mxml which
controls the overall views (logon/register/logout) all in the same box
depending on what state the user is in.

 

In the loginForm.mxml (included in the logon.mxml), I've got a function
called protected returnName():String

 

 

Function I want to call from the loginForm AS3 script:

protected function returnName():String   (I've also tried public in case
it was not available in that area of code)

{

   return this.username.text;

}

 

Snippet from my mxml code:

Xmlns:login="com.ft.views.login.*";

 

...

 

<mx:State name="loggedIn">

 

   <mx:AddChild position="lastChild">

            

   <mx:Panel

       width="75%" height="50%" layout="vertical" 

       verticalScrollPolicy="off" horizontalScrollPolicy="off">

                    

       <mx:VBox width="100%" height="100%" verticalScrollPolicy="off"
horizontalScrollPolicy="off">

       <mx:Text text="{returnEmail()} is logged on;" />   <---------
line in question --------

        <login:LogoutForm  

           logoutSuccessful="this.currentState='onLogin()';" />    

       </mx:VBox>

    </mx:Panel>

                

    </mx:AddChild>

</mx:State>

 

I can't seem to figure out how to reference the method as I get the
error: 1180: Call to a possibly undefined method returnName.

 

I've tried:

<mx:Text text="{loginForm.returnEmail()} is logged on;" />

<mx:Text text="{login.returnEmail()} is logged on;" />

Among many others...

 

This is probably pretty simple.  I really appreciate your help.

 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 

 


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 

Reply via email to