PDA

View Full Version : how to make the data in Listbox to call a movie clip?


bumpbump
02-24-2004, 06:17 AM
http://doc.gold.ac.uk/~ma101hmf/PraticalLevelOne.html

I want to make the English Word brings up a chinese character. Anybody know how to do?

For example, when i click on clothes and press the button Select, the chinese character (it is a movie clip) of clothes will display on the top right box.

red penguin
02-24-2004, 11:22 AM
How are you setting your DataProvider?

If the 'data' is set to the name of a .swf, then you could just ues this within a function to load it into a target....

bumpbump
02-24-2004, 07:35 PM
red penguin, thank you for your information. However, I am still at the beginning level to Flash. Could you show me an example of it? Or you can download my file from

http://doc.gold.ac.uk/~ma101hmf/praticalLevelOne.fla

Inside this file, I have created a chuen movie clip in the library. I want to select one of the english word which will bring up the movie clip 'chuen' to the box under the text chinese character. Can you show me how or do you recommend I should use combo box instead of listbox??

Thank you so much!!

Learner Bumpbump

red penguin
02-25-2004, 11:39 AM
myChangeHandler=function(_cb){
trace(_cb.getValue())
};

Add some info to the DATA in the PROPERTIES. SUch as: clothes.swf, early.swf, etc....and then make this function the CHANGEHANDLER....
In the above function, you can then write a routine for loading in 'that' movie...

Easy peasy!

bumpbump
02-26-2004, 11:48 AM
red penguin

is that mean I still need to use the

code:-----------------------------------------------------------------------------
if($post_code){if(AS_tags_functional()){use_AS_tag s($userName);}else{use_CODE_tags($userName);}}
--------------------------------------------------------------------------------

with the myChangeHandler function..

In addition, i want to make an Undo and Redo button for my program. Do you know what the actionscript syntax for those? At the moment, my program only allows the user to clear the content. This is the code for drawing and clear the drawing :

onClipEvent (load) {
currentColor = "FF0000";
_root.createEmptyMovieClip("copyBox", 100);
function draw() {
_root.copyBox.lineStyle(5, parseInt(currentColor, 16), 100);
x = _root._xmouse;
y = _root._ymouse;
_root.copyBox.lineTo(x, y);
}
function clearCopyPaper() {
_root.copyBox.clear();
}
}
onClipEvent (mouseMove) {
updateAfterEvent();
if (down && _root.copypaper.hitTest(_root._xmouse, _root._ymouse)) {
draw();
}
}
onClipEvent (mouseUp) {
down = false;
}
onClipEvent (mouseDown) {
if (_root.copypaper.hitTest(_root._xMouse, _root._yMouse)) {
x = _root._xMouse;
y = _root._yMouse;
_root.copyBox.moveTo(x, y);
down = true;
}
}

red penguin
02-26-2004, 12:45 PM
Mental note: Remove additional code as footer. People keep mistaking it for 'real' code.

Did you read that code? Please, in layman's terms, read it and tell me what it means....Thank you. The Mgmt.

Undo/redo what? Each stroke?

bumpbump
02-27-2004, 07:48 AM
myChangeHandler=function(_cb){
trace(_cb.getValue())
};


If I understand correctly, the meaning of above code is:

myChangeHandlerthe is a function of (_cb) , the statement is used to return the selected value of _cb to the output window


sorry for my mistaking of your if code.

I will have a go to use this function in my program.

Many Thanks!!

red penguin
02-27-2004, 12:44 PM
Originally posted by bumpbump
the statement is used to return the selected value of _cb to the output window
Yes. It will return the selected value. If you merely use an array to populate the listBox, it will return that value. If you use an OBJECT and specify the 'label' and 'data' properties, it will return the 'data' value.

Avoiding code, you can simply add values to the DATA in the PROPERTIES INSPECTOR (as mentioned above)...

Good luck!

bumpbump
02-28-2004, 12:34 PM
I have tried the code that you provided to me. However, I am still can't make it works. I have put in two labels and data in the combo box. They are (village, separate)/(village.swf, separate.swf). Then i put the code

on (release){
myChangeHandler = function (_cb) {
trace(_cb.getValue());
};
if (myChangeHandler == village) {
pliCharacter.loadMovie("village.swf", 2);
}
}

on the Display Button.

I have also tried the getSelectedItem() instead of getValue().

Could you tell me where my mistake is?

I need to finish this program in urgent. Could you please do an example to show me how to get the separate.swf displays on the green box which is a movie clip called pliCharacter.

Thank you very much!!

http://doc.gold.ac.uk/~ma101hmf/PraticalLevelOne.html

bumpbump
03-01-2004, 02:40 PM
URGENT!!

Can anybody tell me where my mistake is? I still can't make it works.

red penguin
03-02-2004, 10:24 AM
Man, calm down!

You obviously have a bad case of the "I-need-someone-to-do-the-entire-thing-for-me" syndrome.

myChangeHandler=function(_cb){
trace(_cb.getValue())
};

This function stands by itself. Don't 'wrap' it around something else. You will need to use the '_cb.getValue()' part in another statement, such as:
this.$holder_mc.loadMovie(_cb.getValue());

The ONLY thing that you have to do then is to make sure you:
make this function the CHANGEHANDLER
To do this: See the PROPERTIES INSPECTOR PANE? put in there the name of said function. If you just use the initial function I provided, it will trace the value, ie: the data that you have placed in there...

Does this make sense? Do you understand what a CHANGEHANDLER is? The purpose? The reason? How it is evoked? Etc, etc....