Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2003, 04:27 AM
Member
 
Join Date: Jan 2003
Posts: 54
Send a message via MSN to swfbaz Send a message via Yahoo to swfbaz
Default Is it possible to pass object from FFish to flash?

is it possible to pass an array object from FFish Script to flashplayer through FlashPlayer? i tested it... but in vain... would you please help?

for example:

in FFish Script "Initialize" block:

Code:
var arr = new Array("e", "f", "g", "h"); 
FlashPlayer.setVariable("array Var in flash", arr);
i tested this code... but it doesnt work. would you plz also tell that can i pass any object to flash from FFish? just as follows,
Code:
var myobj = new Object();
myobj.id = theId;
myobj.pw = thePW;
FlashPlayer.setVariable("var/object in flash", myobj);
or can i do vise vers? just like...

Code:
var myobj = FlashPlayer.getVariable("some predefined object in flash");
is there any other method? coz i checked both of them... but still its not working. for some reason i need to pass many variables from FFish to flash...if i pass each value one by one.. then it sucks. what if i do it at once?

waitin for your answer...
??? ??? ???
SWFBaz
__________________
SWFBaz Preview [October 2006]
http://www.SWFBaz.com
Reply With Quote
  #2 (permalink)  
Old 01-15-2003, 04:37 AM
Member
 
Join Date: Jan 2003
Posts: 54
Send a message via MSN to swfbaz Send a message via Yahoo to swfbaz
Default Re: Is it possible to pass object from FFish to fl

dear daniel and topcmm,

plz ans quickly to my quests... coz i am keen to be in your contest as quick as possible.. coz after flash.. .your tool inspired me alot. that is why i love it.

now-a-days i m developing an application using flash and SWFKit... plz do help me... i will also include a refference for both of you... coz you are outstanding... 8)

regards
__________________
SWFBaz Preview [October 2006]
http://www.SWFBaz.com
Reply With Quote
  #3 (permalink)  
Old 01-15-2003, 06:27 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Is it possible to pass object from FFish to fl

Thanks, we are glad to help you.

The Flash player methods "setVariable"; and "getVariable"; can only transfer numbers, strings or properties. You cannot transfer arrays or objects by one single call. It's the limit of the Macromedia Flash Player.

1. Transfer Arrays:

When you use "getVariable" with a array, it does not return an array, but returns a string that joins all the elements in the array together with a separator ','. You can use the "split" method to split the string to an array:

To transfer array from ActionScript to FfishScript:

Code:
var str = FlashPlayer.getVariable("array Var in Flash");
var myArray = str.split(",");
It's almost the same to transfer array from FfishScript to ActionScript:
In FfishScript:
Code:
FlashPlayer.setVariable("Var in Flash", arr);
In ActionScript:
Code:
arr = "Var in Flash".split(",");

2. Transfer Objects:

Code:
function transferObject()
{
 * * *this.obj_prop_names = new Array();
 * * *for (var i = 2; i < arguments.length; i++)
 * * *{
 * * * * * *this.obj_prop_names[i - 2] = arguments[i].toString();
 * * *}
 * * *
 * * *this.local_obj_name = arguments[0].toString();
 * * *this.flash_obj_name = arguments[1].toString();
 * * *
 * * *this.fs_to_as = function ()
 * * *{
 * * * * * *for (var i = 0; i < this.obj_prop_names.length; i++)
 * * * * * *{
 * * * * * * * * *FlashPlayer.setVariable(this.flash_obj_name + '.' + this.obj_prop_names[i], 
 * * * * * * * * * * * *eval(this.local_obj_name + '["' + this.obj_prop_names[i] + '"]'));
 * * * * * *}
 * * *}
 * * *
 * * *this.as_to_fs = function ()
 * * *{
 * * * * * *for (var i = 0; i < this.obj_prop_names.length; i++)
 * * * * * *{
 * * * * * * * * *var expr = this.local_obj_name + '["' + this.obj_prop_names[i] + '"]';
 * * * * * * * * *expr += ' = FlashPlayer.getVariable("';
 * * * * * * * * *expr += this.flash_obj_name + '.' + this.obj_prop_names[i] + '")';

 * * * * * * * * *eval(expr);
 * * * * * *} * * * * * *
 * * *}
}
Obj transferObject
Syntax:
* *transferObject(FFish_Obj_name, Flash_Obj_name, Flash_Obj_property_name_0, *Flash_Obj_property_name_1, ..., Flash_Obj_property_name_n);

Prameters:
FFish_Obj_name String. Represents the name of the object in FFish Script
Flash_Obj_name String. Represents the name of the predefined object in ActionScript.
Flash_Obj_property_name_0...Flash_Obj_property_nam e_n
String. Represents the property names of the ActionScript object

Example:
Providing you want to transfer data between AS object "as_obj", which has two properties "id" and "pw", and FS object "fs_obj":

Code:
var fs_obj = new Object;
fs_obj.id = 0;
fs_obj.pw = 1;

var tobj = new transferObject("fs_obj", "as_obj", "id", "pw");
tobj.as_to_fs();
tobj.fs_to_as();
Other methods of SWFKit, such as "bindData", "updateData", etc, *may slao be helpful.

Reply With Quote
  #4 (permalink)  
Old 01-15-2003, 07:19 PM
Member
 
Join Date: Jan 2003
Posts: 54
Send a message via MSN to swfbaz Send a message via Yahoo to swfbaz
Default Re: Is it possible to pass object from FFish to fl

thanx for your qUiCk reply! :P
__________________
SWFBaz Preview [October 2006]
http://www.SWFBaz.com
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:53 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.