Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Old 09-20-2007, 01:11 AM   #1
yomsbea
Registered User
 
Join Date: Sep 2007
Posts: 3
Red face ComboBox code to open external swf in movie clip


Hi everybody,
A total newbie here looking for the following knowledge:
I want to use the ComboBox component to open an external swf file in a movie clip (or in level 2 if too complicated), what im woking on is a store locator where each state in the comboBox menu will open an external swf with the list of stores related to that particular state.

Any help with this code will be appreciated.

Note:
I Looked throu the postings here and found this post from bembino in 2003:
------------------------------------------------------------------------
Place a combobox on frame 1 of the main timeline
Name it externalSWF_cb
Select frame 1 of the main timeline and open the Actions Panel
Type the following code:
// create array of label and data info for combobox
externalSWF_array = [ {label:"Fade JPG", data:"fadeJPG.swf"}, {label:"Load Big JPG", data:"loadBigJPG.swf"}];
// populate combobox with data from array
externalSWF_cb.setDataProvider(externalSWF_array);
// define changeHandler for combobox
function onExtSWFSelected(cb) {
loadMovieNum(cb.getSelectedItem().data, 2);
}
//assign changeHandler to combobox
externalSWF_cb.setChangeHandler("onExtSWFSelected" );
Of course, you would change the externalSWF_array to match your file names.
----------------------------------------------------------------------
List menu on comboBox work just fine but didn't open any of the external swfs.

I'm not a programmer so a code to do this and where to place it will be very helpful.

Thanks a lot, you guys rock!

YMB
yomsbea is offline   Reply With Quote
Old 09-20-2007, 03:10 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

ok. so using the example you posted, try this (once you get it working implement it on your project):
1..create a new blank flash project
2..put a combo box on the stage
3..select combo box, and in properties panel give it an instance name of 'externalSWF_cb'
4..deselect the combo box and open your actionscript panel
5..copy and paste the above code into the actionscript panel
6..create a movieclip and place it on your stage (or create one via actionscript)
7..give your movieclip an instance name 'mcLoader'
8..change the following code:
ActionScript Code:
//old code function onExtSWFSelected(cb) { loadMovieNum(cb.getSelectedItem().data, 2); } //new code function onExtSWFSelected(cb) { mcLoader.loadMovie(cb.getSelectedItem().data); }

hrm.... it has been a terribly long time since i have done something like this, but i believe that is the correct syntax for loading a swf into a movieclip.


try it, see what happens. and welcome to as[org]
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 09-21-2007, 01:29 AM   #3
yomsbea
Registered User
 
Join Date: Sep 2007
Posts: 3
Default ComboBox code to open external swf in movie clip

Hi tg,
thanks for your help.

I tried but didn't work, i wonder what the location of those external swf should be. So far i placed them in the same folder with the main movie.

Any other thoughts?

YMB
yomsbea is offline   Reply With Quote
Old 09-21-2007, 04:04 PM   #4
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

well. are you just running it in test mode? if you're tesing it from a web page, they need to be relative to the page the swf is embedded in, no the actual swf itself.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 09-21-2007, 09:37 PM   #5
yomsbea
Registered User
 
Join Date: Sep 2007
Posts: 3
Unhappy ComboBox code to open external swf in movie clip

Hi tg,
I'm still running it on my local disk and still failing to open the external swf on the mcloader.

Not quite sure what the problem is since i'm not a programmer.

any other idea?

YMB
yomsbea is offline   Reply With Quote
Old 10-29-2008, 01:58 AM   #6
quocdai
Registered User
 
Join Date: Oct 2008
Posts: 3
Default

ok,thanh you.i need it
quocdai is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading an swf into a movie clip layer kingcantona1999 ActionScript 2.0 1 04-23-2007 06:11 PM
insert button in scrolling text field? Babaloo Flash 8 General Questions 1 03-01-2007 02:37 PM
external swf preloader in nested movie clip ROYOW ActionScript 2.0 0 04-12-2006 09:29 PM
code to Load external movie and jump to frame 2?? curacao ActionScript 1.0 (and below) 5 10-21-2004 01:48 PM
Tricky problem with loading external swf into targetted Movie Clip asWarrior ActionScript 2.0 1 06-20-2004 02:14 PM


All times are GMT. The time now is 08:05 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.