473,507 Members | 6,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load a swf with movieClipLoader from the click of a button

37 New Member
Hi

I am trying to load a swf file using the MovieClip loader object.

var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);

At the moment I have the swf loading as soon as a frame is entered on the timeline.

this.button1.onPress = function() {
gotoAndStop("framex");
}

Code on frame

myMCL.loadClip("my.swf", 50);

Is there a way to load the swf as soon as the button is clicked.

Something like


button1.onRelease = function() {
myMCL.loadClip("my.swf", 50);
}

Any help would be welcome!
Apr 26 '08 #1
2 4558
Max58kl
37 New Member
Hi

I seem to have solved the problem using the following code -


imgBtn.onRelease = function()
{
_root.createEmptyMovieClip("holder", 1)
loadMovie("main.swf", "holder");
_root.holder._xscale; //width scale
_root.holder._yscale; //height scale
}

If you want to load a jpg instead of a swf just change main.swf to main.jpg.
You can also specify the hight and width of the file you are loading using -


_root.holder._xscale = 225; //width scale
_root.holder._yscale = 175; //height scale
Apr 28 '08 #2
kelleyg
4 New Member
I use a master SWF called Index, with a main bar of buttons; each button opens a SWF from the assets folder -

For a button called genInfoBtn which, when clicked will open introduction.swf, I wrote this:

//this will load external SWFs
on (release) {
stop();
stopAllSounds();
_root.myMCL.loadClip("assets/swfs/introduction.swf", 5);
}
Jun 6 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6855
by: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
1
2460
by: Jeffrey Kelso | last post by:
I am having an issue where doing a PostBack in ASP.NET is losing the form information. This is happening in a NLB environment with two servers using Application Center When a user selects an...
2
3390
by: Samy | last post by:
Hi There, I have a user control with buttons on it which I use on a aspx page (parent page). On a button click, a modal dialog(aspx page) opens up and the user enters some info in the modal dialog...
3
2199
by: Colazz | last post by:
var myMCL:MovieClipLoader = new MovieClipLoader(); myMCL.loadClip("apin.jpg", "container"); //container is an instance of a movie clip. Now, the size of "apin.jpg" is too large.. is there any...
2
2266
by: Martin84 | last post by:
Hi, ive managed to import files into a main fla document using a moviecliploader command. The code tracks the percentage of the file downloaded so far and shows this information in a preloader bar....
3
21044
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
2
3108
by: GauravGupta | last post by:
i am displaying a table in page load whose data is fetched from database . it also check what data is to be displayed from data base by a session variable. and i have few button which change the...
0
2261
by: chromis | last post by:
Hi, I am trying to get my flash file to load xml data correctly, when i load loader.swf in the browser directly my xml is loaded and the movie functions correctly. However when i embed and load...
1
3625
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
0
7220
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.