Srikanth,

 

I wouldn’t depend heavily on the Flash player - _javascript_ bridge; you depend on the viewing browser when you do this. Were I you, I’d attempt to put –all– your existing logic completely inside Flex. The Flash Player methods (those used by _javascript_) have not changed since Flash Player 3. This should tell you how simplistic (and unsupportive) these methods are. Obtaining references to objects within Flash Player memory is certainly well outside this functionality. From the sounds of things, you need to review your plan fromthe top down.

 

Good luck!

Robert

 


From: SrikanthDuvvuri [mailto:[EMAIL PROTECTED]
Sent: 31 January 2005 09:37 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How do you pass reference to button from MXMLtojavascript??

 

Hey Abdul

 

Does thatmean that I need to pass the id to my _javascript_ and change my _javascript_ function to not bother in extracting the id attribute.. no other go, is what you mean.. am I right??

 

We are working on converting a huge application into Flex and are trying to minimize the extent of code change to the existing app.. that is the reason for looking at not modifying the existing _javascript_ code

 

Srikanth

 

-----Original Message-----
From: Abdul Qabiz [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 1:06 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] How do you pass reference to button from MXMLtojavascript??

 

Hi,

 

> Is there a way in which we can pass a reference of the button from flex to _javascript_ function so that it does not need to be changed at all and it can extract the id attribute and continue in its functionality?

No! You can only pass primitive types (string, number, boolean etc).

 

 

-abdul

 

 


From:Srikanth Duvvuri [mailto:[EMAIL PROTECTED]
Sent: Monday, January 31, 2005 12:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How doyou pass reference to button from MXML to _javascript_??

Hi

 

We have an existing code in which the _javascript_ code (which paints the screen using HTML) invokes another _javascript_ function by passing a parameter “this”. This parameter is a reference to the current object, which could be a button. The destination _javascript_ function then extracts the id attribute of the parameter.

 

Existing Code:

<input type="button" class="button" id="next" multdrcrdet_ONCLICK17(this,this);">

 

Pseudo code of _javascript_:

function multdrcrdet_ONCLICK17(obj,p1)

{

            var tmpBtnId = Obj.id;

            if (tmpBtnId == 'Save' || tmpBtnId == 'Post') {

                        // do something

            }

            else {

                        // do something else

            }

}

 

We are changing thisfunctionality to use Flex. So now the screen is being painted using Flex and we are trying to invoke the same destination _javascript_ function. We need to know a way to pass the object reference i.e. button reference so that the _javascript_ function does not need to change. The workaround that we are doing currently is that we are passing the id attribute of the button from flex and we have modified the _javascript_ function to use the parameter passed to it rather than to extract the id attribute out of the parameter.

 

As we do not know how to pass a reference we are invoking the multdrcrdet_ONCLICK17(\’next\’) and changed the _javascript_ function to use the obj directly rather than doing obj.id  we do not want to change the _javascript_ function

 

 

Is there a way in which we can pass a reference of the button from flex to _javascript_ function so thatit does not need to be changed at all and it can extract the id attribute and continue in its functionality?

 

Thanks

 

Srikanth

 

 

Reply via email to