Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-04-2005, 03:48 PM
Junior Member
 
Join Date: Jan 2005
Posts: 2
Default dialog.FileOpen to listbox

How do I add the filenames and paths to a listbox component from the ffish dialog.fileopen call??
Reply With Quote
  #2 (permalink)  
Old 01-05-2005, 01:00 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:dialog.FileOpen to listbox

The attached sample shows how to do this by using a flash component named "Trigger".

The Trigger component has a "addHandler" method.

In Action script

Code:
trigger.addHandler(handlerFunc);

function handlerFunc(arg)
{
    //do something
    ...
}
If the component is triggered, the handlerFunc method will be called.

How to trigger the component to call the handler function? Just set the value of the "fArg" property of the component.

E.g. in ffish script,
Code:
FlashPlayer.setVariable("_root.trigger.fArg", "Hello world");
The above code set the fArg property of the component to "Hello world", then the handler function will be called with a parameter "Hello world".

With the "Trigger" component, it's very easy to pass data from ffish script to action script.

The steps of adding files into a list box

1. add a "trigger" component into the flash movie
2. add a handler function in action script

Code:
function addFiles(arg)
{
***/*!ffish script will pass a string contains 
***   file names separated by ',', so split it 
***   to an array 
*** */
***
***var files = arg.split(',');
***var i;
***
***/*! add the file names to the list box***
*** */
*** 
***for (i = 0; i < files.length; i++)
***{
******_root.myListBox.addItem(files[i]);
***}
}

trigger.addHandler(addFiles);
3. in the ffish script, trigger the component
Code:
var arr = [];
arr[0] = "c:\\1.txt";
arr[1] = "c:\\1.jpg";

/*!The setVariable method can only pass a string to 
   action script, so we must convert the array to 
   string. Then the value passed to the handler 
   function "addFiles" in action script will be
   "c:\1.txt,c:\1.jpg"
 */
FlashPlayer.setVariable("_root.trigger.fArg", arr.toString());
Reply With Quote
  #3 (permalink)  
Old 01-05-2005, 03:28 PM
Junior Member
 
Join Date: Jan 2005
Posts: 2
Default Re:dialog.FileOpen to listbox

Thanks alot. I am new with this and I had no idea how to pass the data back and forth. Thanks again
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:35 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.