Preloading An External Swf Inside Movieclips
lets say i have an external swf file and i load it to a movieclip name holder mc how do i preload it?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 09-17-2005, 11:08 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Preloading External Movieclips.....problems :-(
Hi,
I'm building a portfolio website with each of the three sections being loaded into the container movie from external swf files.
How can I get the preloader appearing instantly?......currently the screen is blank until about 70% which defeats the point of the preloader entirely.
Any help would be great!
Greg.
Referencing MovieClips Inside MovieClips From The Main Time Line?
is it possible to have event listeners that listen for a movie clip inside a movieclip and then execute a function from the main time line?
Or is it impossible to relate something this far removed? Sounds like a geek Jerry Springer episode!
Something sort of like this:
Attach Code
movie1_mc.closeBtn1.addEventListener(movie1_mc.MouseEvent.CLICK, closeMenu1);
movie2_mc.closeBtn2.addEventListener(movie2_mc.MouseEvent.CLICK, closeMenu1);
function closeMenu1(e:Event):void {
if (e.currentTarget.name == "closeBtn1"){
movie1.gotoAndPlay(27);
movie1.visible = true;
} else if (e.currentTarget.name == "closeBtn2") {
movie2.gotoAndPlay(27);
movie2.visible = true;
}
}
Adding Movieclips Inside Of Two Other Movieclips... XML Powered Slideshow
hello..
I have been working on this project that used part of the kirupa.com tutorial for XML slideshows as a base. What it does is takes a set of thumbnails from an XML file and puts them in a movie clip on different layers. (Each thumbnail a new movieclip on a new layer of the original movieclip)
Anyways, what I am trying to do is make a menu movieclip pop up when a button is clicked. Inside this movieclip is where I want to throw the movieclip for thumbnails to load on. The menu movieclip is working fine and whatnot, but I cannot figure out how to get the thumbnails to load inside that second movieclip.
Here is a chunk of my code:
Code:
function createThumbnailScroller(current_mc, currentThumbFile, thumbCenter) {
thumbnail_scroller.createEmptyMovieClip("t"+current_mc, thumbnail_scroller.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+20)*current_mc;
target_mc.pictureValue = thumbNumb[current_mc];
//trace(thumbNumbforJS[current_mc]);
target_mc.onEnterFrame = function() {
thumbWidth = target_mc._width;
};
target_mc.onRelease = function() {
//tell JS to jump to that slide
flash.external.ExternalInterface.call("jumpToSlide", thumbNumbforJS[current_mc] )
//set scroller movieclip back in its original position (go back to main screen)
yVal = 362;
scroller_move();
};
target_mc.onRollOver = function() {
fadeDown(this);
};
target_mc.onRollOut = function() {
fadeUp(this);
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(currentThumbFile, "thumbnail_scroller.t" + current_mc);
}
"thumbnail_scroller" is the movieclip which is inside of "scroller", the menu movieclip.
Thanks...
EDIT:
I got it working.. I just had to add "_root.movieclipname." in front of the movieclips I referred.
Adding Movieclips Inside Of Two Other Movieclips... XML Powered Slideshow
hello..
I have been working on this project that used part of the kirupa tutorial for XML slideshows as a base. What it does is takes a set of thumbnails from an XML file and puts them in a movie clip on different layers. (Each thumbnail a new movieclip on a new layer of the original movieclip)
Anyways, what I am trying to do is make a menu movieclip pop up when a button is clicked. Inside this movieclip is where I want to throw the movieclip for thumbnails to load on. The menu movieclip is working fine and whatnot, but I cannot figure out how to get the thumbnails to load inside that second movieclip.
Here is a chunk of my code:
Code:
function createThumbnailScroller(current_mc, currentThumbFile, thumbCenter) {
thumbnail_scroller.createEmptyMovieClip("t"+current_mc, thumbnail_scroller.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+20)*current_mc;
target_mc.pictureValue = thumbNumb[current_mc];
//trace(thumbNumbforJS[current_mc]);
target_mc.onEnterFrame = function() {
thumbWidth = target_mc._width;
};
target_mc.onRelease = function() {
//tell JS to jump to that slide
flash.external.ExternalInterface.call("jumpToSlide", thumbNumbforJS[current_mc] )
//set scroller movieclip back in its original position (go back to main screen)
yVal = 362;
scroller_move();
};
target_mc.onRollOver = function() {
fadeDown(this);
};
target_mc.onRollOut = function() {
fadeUp(this);
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(currentThumbFile, "thumbnail_scroller.t" + current_mc);
}
"thumbnail_scroller" is the movieclip which is inside of "scroller", the menu movieclip.
Thanks...
Images Inside MovieClips Inside MovieClips
Hi. I'm trying to create a virtual photo album that you can drag photos into and rearrange them etc. The plan is to have it load/saveable using XML
In my library I have two MovieClips called Page and Photo.
Page is supposed to be able to contain many Photos. A Photo is supposed to hold or be an image (a photo).
I have declared two classes, Page and Photo, which are linked to their respective MovieClips
Actionscript:
class Page extends MovieClip {
private var _photo1:MovieClip;
function Page(){}
public function addPhoto(){
attachMovie("Photo", "_photo1", getNextHighestDepth());
_photo1.loadPhoto("File0025.jpg");
}
}
Actionscript:
import mx.controls.Loader;
class Photo extends MovieClip {
private var _photoLoader:Loader;
function Photo(){}
function loadPhoto(url){
trace("Inside Photo trying to load " + url);
_photoLoader = new Loader();
_photoLoader.load(url);
}
public function onPress(){
this.startDrag();
}
public function onRelease(){
this.stopDrag();
}
}
However, I can't get an image to show. The Photos have to be draggable so they have to be MovieClips. I can't use loadMovie() because I have to abe to control the size of the image. I'm trying to use Loader but I can't get it to work.
Question: What is the best way to allow my Page obj to have draggable images (which I'm trying to do as Photo objects)? I figured it has to use a Loader component.
Advice?
Movieclips Inside Movieclips Problems
hi.
i have a mc called question13 which holds a number of other mc's inside it on the 12th frame, called tick1-tick6. each of these acts as a simple radio button with the following code (for tick1)...
on (release) {
if (_root.tick1select == 1) {
_root.question13.tick1.gotoAndStop(1);
_root.tick1select = 0;
}
else {
_root.tick1select = 1;
_root.question13.tick1.gotoAndStop(2);
}
}
These work fine as they are.
but i need to set the tick1 to look as though it is "ticked" (ie at frame 2) from the main timeline, not within question13, how do i do this?
Calling Other MovieClips Inside Other MovieClips
The problem I am having is a little moe signifcant than what the titles suggests.
What I am trying to do is to determine whether a movieClip, which is nested inside another a movieClip hits another moviceClip, which, you guessed it, is inside another movieClip.
Something along the lines of this:
Code:
onClipEvent(enterFrame){
if( _root.character.charNose_mc.hitTest( this )){
_root.character._x -= _root.char_speed;
}
}
Obviously this code is not working. The movieClip the hitTest( this ) is referring to is inside another movieClip. And charNose_mc is nested inside character at the root level. As you can tell, the goal of this code is to move the character movieClip in a negative direction using a predefined variable called char_speed.
Any ideas on what I am doing wrong, or what is the proper way to format this code? Thanks!
Why Do Movieclips Inside Movieclips Have Different _x And _y Than The Timeline?
I'm confused, why does a MC inside another MC have different _x and _y values than the main timeline?
What I am trying to do right now is animate a MC inside another MC then get the main MC holding everything to move where that new MC ended animating at (it's part of a game I'm making.)
I know it's confusing but Flash shows the cursors current X and Y in the info panel, which is the same as the main timeline. Yet inside the movieclip, an x of 76 and a y of 277 on the timeline is -195 and -30.9 (respectively) inside the MC.
How do I fix it so I can get the _x and _y values to match up so I can tell the main MC to reposition itself to the new X and Y (of the inside MC)
MovieClips Inside Other MovieClips - Detecting All
I have a movieclip called mapWindow, inside mapWindow are dynamically created movieclips of various sizes. The movieclips inside the mapWindow don't take up the entire space of the mapWindow and thus I use a startDrag on the mapWindow upon detection of a mouse press. The problem is, I don't want the start drag to start if the mouse is detected over any of the child movieclips inside mapWindow.
I have a few ideas of how to proceed, but I'm not sure how to reference all child movieclips of a particular movieclip - or something along those lines.
It would be easy to use the hittest function if I knew how to reference all the movieclips I need to, but alas...
Thanks in advance.
Calling Other MovieClips Inside Other MovieClips
The problem I am having is a little moe signifcant than what the titles suggests.
What I am trying to do is to determine whether a movieClip, which is nested inside another a movieClip hits another moviceClip, which, you guessed it, is inside another movieClip.
Something along the lines of this:
Code:
onClipEvent(enterFrame){
if( _root.character.charNose_mc.hitTest( this )){
_root.character._x -= _root.char_speed;
}
}
Obviously this code is not working. The movieClip the hitTest( this ) is referring to is inside another movieClip. And charNose_mc is nested inside character at the root level. As you can tell, the goal of this code is to move the character movieClip in a negative direction using a predefined variable called char_speed.
Any ideas on what I am doing wrong, or what is the proper way to format this code? Thanks!
AS3 - Reading Movieclips Inside Movieclips
hey all. i'm such a noob when it comes to AS3 but i'm determined to learn.
i've had to drop out of strict mode to make this work. can someone tell me why? i've a feeling it has to do with casting maybe. this is in an .as file and not on timeline.
trace(getChildByName("box1").playerStats.x);
in strict it throws up "1119: Access of possibly undefined property playerStats through a reference with static type flash.displayisplayObject."
yet trace(getChildByName("box1").x); works just fine.
also i want to refer to it dynamically with "box"+i. do i use this["box+i].playerStats.x?
edit: trace(getChildByName("box"+playerPos).playerCards.x); seems to work ok!
help!
Preloading Swf Movieclips
Hi there peeps
I'm having a problem... not least coz i live in london and have just heard that afghanistan has been bombed and the cia say that there is AT LEAST 100% chance of a retaliatory terrorist attack. boo. Anyone in new zealand wanna swap homes?
Nope my problem is happy and small in comparision:
Is there any way of preloading external swf movie clips, so that they are automatically in the file BEFORE i call them?
The reason being is that i have a place on my home site where i show a few pictures of projects i have done. Each project is a swf file comprised of a few images. At the moment these images are shown one by one with a button click, and they loop.
However everytime the user clicks from the last image back to the first (what should be a transparent process...) the whole swf clip is loaded in again.... obviously not necessary, but i dunno how to get around this.
I have found a way of preloading text (using textbox swapping) but not swf files.
Any bright spark out ther got any clues?
Hope you do, nice people!
Preloading Movieclips?
Please help!! - I'm stuck...
How do I get my preloader to load a movieclip timeline instead of the main timeline?
Preloading And Movieclips
Hi
I have a movie with at movieclip called "clip1" where i load a seperate swf into using the loadmovie-command.
On the first frame of the movie I have a preloader. The problem is that it only checks if the root is loaded and starts playing before the external swf is loaded into "clip!".
How do I make a preloader that checks both the root-timeline and the movieclip?
I have tried this script, but it does not seem to work:
if (_root.getBytesLoaded() != _root.getBytesTotal() && _root.clip1.getBytesLoaded() != _root.clip1.getBytesTotal()) {
gotoAndPlay (1);
}
If someone can solve it, I will send loads of good carma the other way!!!
Kind regards,
Bjarke Myrthu, journalist, Denmark
Preloading Movieclips
People
I have a flash movie and at the end of the movie i am inserting three movieclips in specific places. This is done manually in the timeline each on its own keyframe. Each mc has a preloader inside it, but the preloader does not work. how do i go about preloading these movie clips individually????
Or do i just say on the keyframe loadmovie and call in the .swf file??
with a preloader in that .swf file.
If you can understand my problem then some help would be fantastic.
Shott
Preloading MovieClips
I have been trying to figure out how to preload individual movieclips with a loadbar and percentage text.
It would be nice to use the "createMovieCip" action and set it up within that, then after its done preloading use "removeMovieClip."
Any help would be greatly appreciated!
Preloading Movieclips.
Hi,
I have a site with a couple of very big movieclips in it. Is there a way of preloading the movieclips in flash without using external swfs?? I mean keep the movieclips in the same swf but only load them when necessary?? I can do it the external way, just wondering if it can be done all within one movie..
Steven.
Preloading A Scene With MovieClips
I've designed a Flash movie that consists of 2 scenes (a "Preloader" and a "Main" scene). My "Main" scene consists of 1 frame with numerous movie clips. I have no problem getting the movie to preload and then jump to the "Main" scene. The problem is, none of the movie clips will play once the movie jumps to the "Main" scene. Is there any way of making this work? Or do i need to use my movie clips as seperate .SWF files and load them that way? Any help will be greatly appreciated!
Preloading Nested MovieClips
http://www.7inone.info/sid/
ok that's the site I'm looking at - so far so good, but I wanna add preloaders to each child movieclip.
this is how it works:
I have my main movie (main.swf). On frame one, the background movie (bg.swf) is loaded into level0. When bg.swf reaches a certain frame (the end of the animation) it loads all the other little movies (right_nav.swf, left_nav.swf, etc.) into various MC holders in main.swf.
so I'm trying to make a preloader for bg.swf - because it's the largest .swf file, and takes a while to load. Scene 1 of bg.swf is all of one frame long - into which various MCs are placed. I make another Scene, and call it preloader - it comes before Scene 1, and that's where I'm stuck. I use "ifFrameLoaded". But the frame I'm trying to target is found like this:
Scene 1 - Stargroup - Frame70.
what's the scripting???? please help!!!! I'm Desperate!!!
thanks a bunch
sid.
[CS3] Preloading Attached Movieclips
So I have a movie clip that attaches movies clips ...main.attachMovieClip(...)...
When ever I try to use a preloader it will not work. I am using this preloader:
http://www.kirupa.com/developer/mx/p...epreloader.htm
Any ideas as to what I can do?
PreLoading Attached MovieClips
Hey,
Im actually doing this in CS3 beta xD, but I thought I would post in Flash 8 as it doesnt make any difference.
What i need is to load my images into individual movieclips created before the movie starts. After the movie started I want it to attach the movieclips using the attachMovie(...) method. I don't know how to dynamically make linked movieclips for use with attachMovie() and I don't know how to load content into them for use over and over again without re-loading. I obviously know how to load stuff into flash in real time but not before the movie starts, and I don't know how to create MCs with linkages via actionscript.
If it is possible help would be appreciated! (I know its not clean but its the best chance I have on my time scale )
Thanks,
Dan
Tweening External Dynamic Text Inside A MC Inside Main Timeline
I've seen a hundred and a half posts on similar subjects, but goshdarnit, I just can't make this work. Let me explain the problem, and I've included a link to a Zip file with my .fla file and the away.txt file I'm calling the variables from.
Basically, I want to create an interactive menu thing, that starts with a row of each of the 26 letters of the alphabet. When one clicks on a letter, the letter is tweened to a larger faded state, and so is the rest of the alphabet, and I want the names of the schools starting with that letter to then fade in. I have a movie clip inside the last frame of the main tween, which should then tween (fade in over 12 frames) the graphic symbol containing my dynamic text box, which is supposed to be linked to the text variables in the external file. The text variable is created on the first frame of the main timeline using Actionscript on the static header layer, and so I should be able to load it inside my movie clip (I think). Everything looks fine to me, but then I've only been using Flash for 2 weeks.
To sum up, I need to tween the graphic symbol. The graphic symbol contains the dynamic text which references the external text file. The graphic symbol is inside a movie clip, inside one frame of my main timeline. The text isn't showing up, only the empty text box is.
My Zipped source files can be found at: http://www.tolcs.org/athletics/away.zip
If anyone would be willing to download my source files and give some wonderful advice, I'd revere and adore them forever.
Preloading Scripts & Linked Movieclips
Using flashMX
Im trying to get a preloading script to work while at the same time having Movies in the library linked and the option 'export in first frame' clicked.
Now I know linking movie clips and marking them for export in first frame causes the preloader to only show the percentage at the very end, but as far as a work around goes... Im not having any luck.
From what I understand after reading numerous forum posts on the subject, I need to mcHolder.loadmovie("main.swf"), where mcHolder is the placeholder movie clip and Main.swf has all the _root.attachMovie Linked MC's, onto the preloader timeline.
And then get the preloading script to target mcHolder. The theory I think I have, but converting it into code is where Im coming unstuck.
What does the setup look like ? Do I use scenes ? can everything, preloading script, imported main.swf etc be on the first frame ?
How do I get my preloading code to target the external movie and check the percentage download on the imported .swf as its coming in?
Im using 3 scenes, however I've read on the forums that using scenes is not a good idea, specifically when your movies become more complex.. So i need to throw that out of the door.
Here's my current layout, without the _root.attachMovie Link Fix. I have 3 scenes. Scene 1 named "preloader". Scene2 named "Main" and Scene 3's name is "Dummy". Bearing in mind I dont want to use scenes in Future.
Scene1, where the preloading scripts resides has 2 frames.
Frame 1 has the following Actions.
//Scene1 Preloading Script
total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
_root.checker = percent_done+"%";
_root.bar._xscale = percent_done;
ifFrameLoaded ("dummy", 1) {
gotoAndPlay("main", 1);
}
//End
_root.checker is the dynamic text block where the percentage is shown.
_root.bar is the loading bar.
Frame two has a simple "gotoAndPlay(1);
Scene2 is one frame with all my declared variables and functions sitting on a layer called "scripts" On the Root timelime aswell I start my flash movie dynamically. I.e
_root.attachMovie("movname", "movname" 10); and a Stop(); at the very end.
Scene3 has one single frame with a Stop();
This works aslong as you dont Link and export in first frame.
Preloading Screen With AS 2.0 And Exported MovieClips?
I am having a major problem here...
I have a flash movie that is 500kb in size. I have just now decied to make a loading screen. My coding for the preloader is working fine, but it doesnt show up until about 47% into loading!
I know this is because other things such as the 11 external AS 2.0 classes and the movieClips exported in the first frame are loading, but I need my preloader to load so it can display how far the loading is!
Please Help Me!!!
Thanks in Advance,
Chris
Preloading Movieclips With Linkage Names?
Hi guys,
I have a flash movie with a lot of linked movieclips in my library (mc's with linkage names). I have a preloader in the beginning of the flash movie. However, the preloader doesn't show until (I guess) all those linked movieclips are downloaded first. Then the preloader starts showing, starting at something like 40% . How can I include the linked movieclips in my preloading, such that the preloader shows straight away, from 0% ?
Thanks
Preloading Into Movieclips Located In The Library
I need to load external .swfs into movie clips I have in my library.
I think I'm missing something here. I have 30 movieclips in my library (instance_1, instance_2, etc....) They all have a unique linkage (instance_1, instance_2, etc....) and are placed far off stage in the 2nd frame then are placed into an array and tweened via actions script. I want to make each one load an external .swf in a sequnce when the playhead enters the frame my 3D code is in. My problem appears to be with attachmovie or some other function...
here is the site:
http://bravist.com/bravist.html
-You can see I currently have a preloader (similar to one here on kirupa http://www.kirupa.com/developer/acti...cliploader.htm) in the first 3 movieclips, but I want one common preloader that draws the external files from an array and places them into my clips
here is a section of my code that controls my movieclips:
Code:
var numItems = 29;
var focalLength = 1000;
var centerX = (Stage.width *.5);
var centerY = (Stage.height*.5);
for(var i = 0; i<=numItems;i++){
this.attachMovie("instance_" + i, "instance_mc_"+i,i);
clip = this["instance_mc_"+i];
myXYarray = new Array([(Stage.width*.217)-centerX, (Stage.height*.25)-centerY],
[(Stage.width*.224)-centerX, (Stage.height*.26)-centerY],
[(Stage.width*.231)-centerX, (Stage.height*.27)-centerY],
[(Stage.width*.238)-centerX, (Stage.height*.28)-centerY],
[(Stage.width*.245)-centerX, (Stage.height*.29)-centerY],
clip.x = myXYarray[i][0];
clip.y = myXYarray[i][1];
myzarray = new Array([(focalLength*.150)-focalLength],
[(focalLength*.175)-focalLength],
[(focalLength*.200)-focalLength],
[(focalLength*.225)-focalLength],
[(focalLength*.250)-focalLength],
clip.z = myzarray[i][0];
clip.swapDepths(-clip.z);
As you can see I already have attachmovie to load my clips into the array, but I can't get a preloader to work.
Many Thanks,
Preloading, Scaling & Moving Movieclips [fla: CS3 AS2]
[fla: CS3 AS2]
Hi, I was wondering if anyone on here can help me fix a gallery I'm building.
Basically, my aim is this:
Click on a thumbnail and the corresponding image is preloaded BEFORE scaling and moving smoothly from the thumbnail position to a target position.
(the thumbnail is actually the container for the loaded image, and therefore also moves to the target)
I have got everything to work, except that the thumbnail moves whilst the image is still loading. This problem defeats the purpose of the gallery, and I'm starting to get blurry vision now!
I hope I have made everything clear, but since this is quite difficult to explain, I have attached the fla and images.
*You will need to simulate download in flash for the current preloader to work.
Any help on this would be awesome.
Cheers in advance
//P.s. much of the script was (heavily) adapted from an fla I found somewhere, in which the images are arranged into a circle. If anybody knows who scripted that, please let me know, because I like to give credit where credit is due.
Movieclips Inside Movieclips
hi.
I am having problems with my game. I want to make bombs and for this i needed a movieclip 1 inside movieclip 2. When movieclip 1 is touched by the player the movieclip 2 plays. I have had no success so far and i cannot use such things as nameing the bomb as it wil take too long because i would like to c +p loads on the game.
Here are the codes i have tried:
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
_root.play ();
}
that made the main frame change.
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
play ();
}
this did nothing
i also tried this but it did not work.
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
_root.this.play ();
}
Have you got any ideas? i tried to provide code and my errors like i must. thanks
Preloading An .swf Inside Another .swf
I'm trying to preload a whole main.swf inside a preloader.swf using the Loader class, the inside of my preloader.swf document class constructor is something like this:
Code:
var myRequest:URLRequest = new URLRequest("main.swf");
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);
and so on..
The preoloader finishes loading the total seize and I just don't see anything no error, no swf... I placed a trace statement at the Main constructuor and it traces it into the preoloader.swf, but I don't really understand why can't I see the movie. Any help or pointing towards a tutorial would be greatly appreciated although I have already scraped through the web for answers
Preloading, Movieclips&Components Exported On First Frame
Hi,
How to preload a flash movie which has movie clips and components loading on first frame?
All my movie clips are dynamic and I had to chek in the Export in first frame option. Components in default are exported to the first frame.
Help me out
Kirthi
Trouble With Sound Library/sub-movieclips/preloading
I'm building an application in MX that needs to use a fairly large library of sounds that are exported for actionscript in the first frame (as per the default linkage settings) and the movie won't display the first frame until it finishes downloading all the sound data.
I tried building a preloader file that would load my application into a movie clip, but the sounds would never play from inside the clip. I'm never referencing the _root in any of the script, so I'm not sure where the problem is. I can't figure out how to even check to see if the sound files are being attached to the sound object when I call them or if it's simply doing some sort of stopallsounds command at random.
I have also tried loading the application into the root level of the pre-loader but even though the sounds work properly when I do it, the preloader graphics are all wiped out as soon as the application begins to load and I'm stuck leaving users with a blank screen until all the files finish loading.
Does anyone know of a problem with defining a sound object inside of a movie clip (I tried setting them all to _root also and that had no effect either) or is there some problem with referencing an externally-loaded library if it's not in the main timeline? I would have just spread out all the sounds on different frames but the whole point of the application is to make it simple to dump a bunch of sound files into the library without having to attach them to specific frames.
PreLoading Movieclips In The Background (meaning They Aren't Seen)
Hello all,
I was looking at this website: http://www.magwerk.com/
and I noticed that when you click to read a magazine it loads ALL the pages of the magazine one by one in the background.. until the magazine is fully loaded. That way the user won't have to wait for the WHOLE magazine to load before being able to read it.
I basically want to do the same with my project. I want to load the movie clips from an XML file and load them one by one in the background.
Can someone point me in the right direction.
PS. I'll be using FLASH 6 Player.
PSS. But I'll be upgrading the site to FLASH 8 player in a few months.
Visible Of MC Inside Other MovieClips
I use the code blow to load backgrounds only once in my movie as they are needed. I use the function to manage their _visible state so that if the background was already loaded I just make it visible and make all the other visible = false. I got the loading working and it seems that the properties are changing properly too, however I always see only my first background loaded and none of the other ones are showing. Can anybody tell me what is it that I'm doing wrong?
MovieClip.prototype.loadImage = function(instName, level, x, y, width, height, imgPath) {
var myMCL = new MovieClipLoader();
myMCL.onLoadInit = function (targetMC)
{
targetMC._x = x;
targetMC._y = y;
targetMC._width = width;
targetMC._height = height;
};
this.createEmptyMovieClip(instName, level);
myMCL.loadClip(imgPath, this[instName]);
delete myMCL;
};
function addBackground(bgFile) {
if (_root.bg == undefined) {
_root.createEmptyMovieClip("bg", 99);
_root.bg._x = _root.text_scp._x;
_root.bg._y = _root.text_scp._y;
_root.bg.bgCount = 0;
_root.bg.bgArray = new Array();
}
if (showBG(bgFile) == false) {
_root.bg.loadImage("BG" + _root.bg.bgCount, _root.bg.bgCount, 0, 0, _global.defaultMovieWidth, _global.defaultMovieHeight, _global.backgroundImage);
_root.bg.bgArray[_root.bg.bgCount] = bgFile;
//trace("Added New Background: "" + _root.bg.bgArray[_root.bg.bgCount] + "" at position " + _root.bg.bgCount + " with name "" + _root.bg["BG" + _root.bg.bgCount]._name + """);
//trace("Element added has now visible set to "" + _root.bg["BG" + _root.bg.bgCount]._visible + """);
_root.bg.bgCount = _root.bg.bgCount + 1;
}
}
function showBG(filePath) {
var rtVal = false;
//trace("Call ShowBG with count: " + _root.bg.bgCount);
if (_root.bg.bgCount > 0) {
for(i = 0; i < _root.bg.bgCount; i++) {
//trace("Element " + i + " has " + _root.bg.bgArray[i] + " and we are setting visible to "" + (_root.bg.bgArray[i] == filePath) + """);
_root.bg["BG" + i]._visible = (_root.bg.bgArray[i] == filePath);
rtVal = ((rtVal) || (_root.bg["BG" + i]._visible));
//trace("Element " + _root.bg["BG" + i]._name + " has now visible as " + _root.bg["BG" + i]._visible);
}
}
return rtVal;
}
Buttons Inside Movieclips
Hi, using FlashMX(6) here and i am having trouble with buttons inside movieclips. I have a basic dialog in the form of a MC that comes up with "ok" and "cancel" options. Within my Actionscript i have
EXAMPLE;
attachMovie("NewDialogue","myDialogue",2);
myDialog.OKButton.onRelease = function(){
myCode;
}
Here is the thing. It works perfectly fine when the dialog is called up from the main script (like above), either within a function or outside.
But when this dialog is attached via clicking on another button, the Dialog appears but the buttons not longer work when you click them.
EXAMPLE;
attachMovie("NewButton","Button",1);
CreateDialogueButton.onRelease = function(){
attachMovie("NewDialogue","myDialogue",2);
}
All i can think of it resorting to Hit-testing, but i would prefer to find out why my current method does not work.
Thanks for your time
irreal
Buttons Inside Movieclips
ok, so i'm making a site, for the links banner i have a movieclip that scrolls in a infinite loop. the banner is a single image and i'm using invisible buttons over the different parts for the links.
the problem is that even though i know the code on the buttons is correct, they just don't work. my guess is that it has something to do with the fact that the buttons are inside another movieclip. the movieclip the buttons are inside already have some code that uses the mouse (it's one of those deals where the position of the mouse over the movieclip determines the speed the movieclip moves at). i think that since the outer movieclip is already using the mouse, it's blocking the buttons inside it from getting recognized.
but that's just my guess. any help would be great.
thanks.
[CS3] MovieClips Inside A Movieclip
Flash is making me feel like a damn fool. Granted I've only been using it for a few weeks.
Alright, so I've got a bunch of movieclips inside of another movieclip. Inside the movieclip (called star_mc) I have another movieclip called mcStarburst, that I want to play when I roll over the clip. I have a frame with the stop(); command on the first line.
When I run the thing though, I just get a bunch of errors. I can't click on the thing and get a trace statement in my output, and the starburst animation just plays over and over again, completely disregarding my stop command.
And on top of that not even my buttonMode works right. What gives?
Here are the errors:
1119:Access of possibly undefined property mcStarburst through a reference with static type Function.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1119: Access of possibly undefined property buttonMode through a reference with static type Class.
And here is the code I'm using:
star_mc.addEventListener(MouseEvent.CLICK, onClick);
star_mc.addEventListener(MouseEvent.ROLL_OVER, playStarBurst);
function onClick(event:MouseEvent):void
{
trace("Ok this better work")
}
function playStarBurst(event:MouseEvent):void
{
play.mcStarburst;
}
star_mc.buttonMode = true;
Preloader Inside Movieclips?
Hi,
I've made a movieclips gallery, where each button plays another movieclip. the problem is a few of the movieclips are quite big and runs slowly. how can I create a preloader inside the movieclips?
thanks in advance,
uriash
Embed 2 MovieClips Inside Of 1
Hey.
At the moment, I think I may have figured out my problem, but maybe I haven't. I need to get this thing to work if I want it to work. I was wondering if I have 2 movie clips, each holding an image loaded by loadclip where the second image is supposed to be 80 pixels below the first, how I would make it so that these are combined into 1 new movieclip object
Thank you.
Buttons Inside Movieclips
Hello everybody....
I am relitivley new to Flash and using action script and I am having a problem getting the buttons in my menu to work.
I have a menu which slides in from the bottom when a invisible button is rolled over and slides out when you rollout of the menu, this works fine....
inside this movie clip I have 5 navigation buttons which fade in when the menu has slided out completely but the problem is they dont work....
I have tried putting the code on the keyframe of the mc when the menu is fully out and is in a static position and also inside the buttons themself but neither worked....
Code:
contact_btn.onRelease = function(){
getURL("http://google.co.uk");
}
Code:
on(release){
getURL("http://google.co.uk");
}
I can make working buttons on the main stage no problem but I am pulling my hair out trying to get buttons that are inside a movieclip to work, am I going about this the wrong way or have I missed something?
any help is greatly appreciated.
Buttons Inside Movieclips
I have a movieclip named blueHome...
in my first frame, I use the following code:
Code:
blueHome.useHandCursor = false;
blueHome.onRollOver = function () {
blueHome.gotoAndStop(2);
}
blueHome.onRollOut = function () {
blueHome.gotoAndStop(1);
}
in frame 2 of blueHome, I have 3 buttons that don't work (as in, when I rollOver them, the hand cursor does not appear, the buttons do not switch to the "Over" frame, and when I attempt to click on them, it doesnt work...
Why is this happening, and what can I do to make the buttons work?
I've tried moving the buttons outside the movieclip and into a frame just above it (so that when I rollOver the movieClip, it makes the buttons visible, and when I rollOut, it makes them invisible)...but the problem is, when I rollOver the buttons, then macromedia treats it as if I've rolled out from the movieClip...
are there any other options?
Movieclips Inside Sprites
for some reason i get errors when i try to put movieclips inside sprites...
like
Code:
package com.Huh
{
import flash.display.Sprite;
import com.Huh.Innards;
public class Wow extends Sprite
{
public function Wow()
{
var myInnards:Innards = new Innards();
addChild(Innards);
}
}
}
and then
Code:
package com.Huh
{
import flash.display.MovieClip;
public class Innards extends MovieClip
{
public function Innards()
{
trace('im here');
}
}
}
doesn't let me. i guess if there are ANY movieclips inside something all the parent display objects MUST be movieclips? is that true?
or am i just missing something here...
ty in advance!
Buttons Inside Movieclips
I nested my footer buttons inside a movie clip so that I could align them all to the bottom of the stage without changing their distribution to one another. However, when I test my flash movie these buttons are not affected by a mouse rollover or when they are clicked. How can I get a button's down/over roll over effects to act from within a movieclip? I've attached the fla source so u can better understand my dilemma. All suggestions welcome n thanks in advance for the help!
Buttons Inside Movieclips
Hey fellas, I got a problem with this image scroller panel I made. It's made out of a movieclip, and inside there are 9 thumbnails, which all are buttons. Now my problem is that I don't know how to address the buttons inside my movieclip. I want to give the buttons inside my movieclip and action like, oprelease gotoandstop. Basically just jump to another frame in the timeline. THis is my code for the image panel scroller. It scrolls up and down depending on the mouse position inside the stroke. This is the code.
Code:
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
function panelOver(event:MouseEvent):void {
panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
panel.addEventListener(Event.ENTER_FRAME, scrollPanel);
}
var b:Rectangle = stroke.getBounds(this);
function scrollPanel(event:Event):void {
if(mouseX < b.left || mouseX > b.right || mouseY < b.top || mouseY > b.bottom) {
panel.removeEventListener(Event.ENTER_FRAME, scrollPanel);
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
}
if(panel.y > 617.6) {
panel.y = 617.6;
}
if(panel.y < 387.7) {
panel.y = 387.7;
}
var ydist = mouseY - stage.stageWidth / 2;
panel.y += -(ydist / 7);
}
Now this works fine, I have a problem however when I want to give the buttons INSIDE the MC an action. I want the project to jump to a certain frame on the timeline, when u click on a button. So i got the advice to add the following code to my actions.
Code:
/*--------------------------------------------------------------------------------------------------
mouse events will, by default, propagate down to the children of the movieclip "panel".
This script should work as is for an unlimited number of nested movieclips.
Weak reference is set to true in the event listener to improve GC performance.
--------------------------------------------------------------------------------------------------*/
panel.addEventListener(MouseEvent.CLICK, imgClick, false, 0, true);
var imgName:String = "";
function imgClick(e:MouseEvent):void {
imgName = event.target.name;
trace(imgName);
gotoAndStop(imgName);
/*--------------------------------------------------------------------------------------------------
This function sends the playhead to the frame label that matches the instance name of the event.target.
So, for example, if you click image "img1", the playhead will go to frame label "img1".
All you have to do to make this work is to name your frame labels accordingly.
--------------------------------------------------------------------------------------------------*/
}
So I added it, gave frames in my timeline a label name, matching the buttons instance name. So theoretically it should jump to the label on the timeline. However I get the following error.
Code:
1120: Access of undefined property event. source: name=target.event.name;
Does anyone know how to solve this? Thanks in advance!
MovieClips Inside MovieClip
Hi everyone,
Im trying to get the number of mcs that I have inside another one:
Code:
var mc1:MovieClip = new MovieClip();
var mc2:MovieClip = new MovieClip();
var mc3:MovieClip = new MovieClip();
mc1.addChild(mc2);
mc1.addChild(mc3);
for ( var i in mc1 ) {
trace( i ); //this used to work in AS2
}
my problem is that it even doesn't get inside the for loop for the trace... :P
is there any other way to get to the movieclips inside another movieclip?
THKX,
Loading XML Inside MovieClips
Hi all,
Got the following problem:
I'm trying to load an XML file in Dynamic text fields that are
placed inside movieclips. Nothing is loaded.
Anyone knows what code is necesary to load an XML data in
dynamic texts that are in movieclips inside movieclips?
Maybe a special way to write the path?
thanks for your help!
Buttons Inside Movieclips
code on root timeline
stop();
var links = new Array("about", "closet", "contact", "links");
for (var i = 0; i<links.length; i++) {
link = links[i]
trace(links[i]);
_root[links[i]].item_button.onPress = function() {
trace(links)
trace(i)
trace(links[i])
trace(links[1])
};
}
i dont understand why this does not work.
the links array are movieclip names
and item_button is the button inside the movieclip names.
example about.item_button.
everything traces except when i try to access an array index using the variable i it returns undefined! but when i access an array hardcoding the number it returns the correct value. very akward...
Buttons Inside Movieclips
Hey fellas, I got a problem with this image scroller panel I made. It's made out of a movieclip, and inside there are 9 thumbnails, which all are buttons. Now my problem is that I don't know how to address the buttons inside my movieclip. I want to give the buttons inside my movieclip and action like, oprelease gotoandstop. Basically just jump to another frame in the timeline. THis is my code for the image panel scroller. It scrolls up and down depending on the mouse position inside the stroke.
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
function panelOver(event:MouseEvent):void {
panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
panel.addEventListener(Event.ENTER_FRAME, scrollPanel);
}
var b:Rectangle = stroke.getBounds(this);
function scrollPanel(event:Event):void {
if(mouseX < b.left || mouseX > b.right || mouseY < b.top || mouseY > b.bottom) {
panel.removeEventListener(Event.ENTER_FRAME, scrollPanel);
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
}
if(panel.y > 617.6) {
panel.y = 617.6;
}
if(panel.y < 387.7) {
panel.y = 387.7;
}
var ydist = mouseY - stage.stageWidth / 2;
panel.y += -(ydist / 7);
}
Using External .txt Inside Movie Clip Inside .fla
I've seen a hundred and a half posts on similar subjects, but goshdarnit, I just can't make this work. Let me explain the problem, and I've included a link to a Zip file with my .fla file and the away.txt file I'm calling the variables from.
Basically, I want to create an interactive menu thing, that starts with a row of each of the 26 letters of the alphabet. When one clicks on a letter, the letter is tweened to a larger faded state, and so is the rest of the alphabet, and I want the names of the schools starting with that letter to then fade in. I have a movie clip inside the last frame of the main tween, which should then tween (fade in over 12 frames) the graphic symbol containing my dynamic text box, which is supposed to be linked to the text variables in the external file. The text variable is created on the first frame of the main timeline using Actionscript on the static header layer, and so I should be able to load it inside my movie clip (I think). Everything looks fine to me, but then I've only been using Flash for 2 weeks.
My Zipped source files can be found at: http://www.tolcs.org/athletics/away.zip
If anyone would be willing to download my source files and give some wonderful advice, I'd revere and adore them forever.
Preloading Child Movieclips Individually And Playing Them AFTER They're Fully Loaded
i just want each of my child movieclips to play AFTER they're fully loaded individually. Could somebody please help me out? where did i go wrong here? what did i miss? Please help me out. thank you.
this is what i have right now:
loader_mc._visible = false;
picLoader._visibility = false;
var mcLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
mcLoader.addListener(myListener);
myListener.onLoadProgress = function(target_mc,bytesLoaded,bytesTotal) {
loader_mc._visible = true;
picLoader._visible = true;
var pctLoaded = Math.round(bytesLoaded/bytesTotal*100);
loader_mc.bar_mc._xscale = pctLoaded;
if (bytesLoaded >= bytesTotal) {
loader_mc._visible = false;
}
}
btn_1.onRelease = function () {
mcLoader.loadClip("child_mc_01.swf",picLoader);
}
btn_2.onRelease = function () {
mcLoader.loadClip("child_mc_02.swf",picLoader);
}
btn_3.onRelease = function () {
mcLoader.loadClip("child_mc_03.swf",picLoader);
}
|