[MX04] Communication Between Two Movie Clips
I am stumped on this one, so maybe someone wiser to the ways of Flash MX04Pro might help. I'm not sure how to illustrate this problem very well so please let me know if the following is completely confusing.
I currently have a file with the following basic structure:
MAIN TIMELINE {frames: a {containing MC X with local timeline including frames: I, II, III... } , b, c {containing MC Y with local timeline including frames I, II, III ... } d ...}.
What I am trying to do is have a button in (MAIN TIMELINE/frame a/MC X/ frame II) cause the playhead to move to (MAIN TIMELINE/frame c/MC Y/ frame III). Whew.
I first attempted to place this code in the button (with the actual instance names, of course, and not these):
Code: on (release) { _root.gotoAndPlay("c"); _root.MC Y.gotoAndPlay("III"); } I was hoping that this would cause the main playhead to move to the desired frame in the main timeline and then cause the MC's playhead to move it's desired frame in it's timeline. No luck.
My next thought was to create a function that sent a variable to the MC that would tell it which of it's frames to play. However, I am shaky on how to do this. Can anyone lend a hand?
Thanks, and let me know if I need to explain this more thoroughly or post more detailed code.
-ZR
FlashKit > Flash Help > Flash Newbies
Posted on: 08-05-2006, 12:39 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Communication Between Movie Clips....
Ok having troubles here. I no how to communicate from a movie clip to the main timeline using the _root. function but i need to no how to communicate just between movie clips.
I have 3 movie clips.
MC 1
MC 2
MC 3
Inside MC 1 there is 4 buttons.
Inside MC 2 i have MC 1 inside off it cause off some actionscript i have on it.
I then have MC 2 inside MC 3 and i need to link the buttons from MC 1 to frame labels inside MC 3 does anyone have a clue how i can go about this cause the _root function isnt working it just goes back to the main timeline. I sure hope that someone can help me here cause its driving me crazzy and its stoped me dead in my tracks off creation. Any help that can be offerd will be appreciated.
Thanks
Communication Between Movie Clips
Is it possible for a button situated in "blankOne.swf" to control the actions of a movie clip which has been loaded into "blankOne.swf" via loadMovie();???
Further explanation:
I have created a sort of template.swf which only includes site navigation buttons and empty space for the external movies to load into. From these navigation buttons I am trying to trigger events in movie clips which have been loaded using loadMovie(); So far, no matter how I script the path I can't get it to work. Is what I'm trying to do even possible??
Thanks in advance to anyone who can help
[MX04]Movie That Works Fine When Clips Apart Acts Strange When Clips Are Together.
Hi,
I have a pretty basic movie in which a ball moves along a track.
The track is made up of 3 sections & all I want the movie to do is trace an ID number (num) that is an individual property of that clip when it goes over it.
In the first movie attached below “trackOne” the whole thing works great! However in the other movie “trackTwo” I have moved the clips closer together & the whole thing has gone crazy with the following issues.
1.)The “trace” command fires on every “onEnterClip” event
2.)A text field that is used to show the ID number only changes when the ball is fully over the clip not as it first touches it, as it does in the first movie
3.)Although the ball is full off a clip it keeps tracing it’s ID number together with the new clips number?
Anybody able to help me on this?
Simple Communication Between Movie Clips
Hi,
Can anyone point me in the direction of a simple demo .fla that will show me the new way of communicating between flash clips. I haven't used Flash since v 5, but have just started on a project using Flash MX 2004. All I want to do is call a custom function in one clip from another. The docs don't really help me out...
Thanks in advance
Actionscript Communication Between Movie Clips
I have a question in the communication between movie clips. Suppose that we have 2 movie clips (mc1 and mc2, mc2 is attached to mc1), and we have a variable in mc2. My question is how can we use the variable which is defined in mc2 in mc1? Is that possible?
Loaded Movie Clips Communication With _root Movie
I am trying to produce an app for the ppc ipaq. I want to load the various movies into the root movie. this works ok.
I cannot get a button in a loaded movie to fire a function from the main holder movies _root . This is my function in the holder movie _rot I want to fire from the button in the loaded movie.
function getrules() {
removeMovieClip("splash");
loadMovieNum("rules.swf", 1);
}
Thanks for any help.
Communication Between Movie Clips And Main Movie
I have Flash 4 and created a little intro movie clip that I would like to use in multiple movies. I want the movie clip to complete before I begin the main movie, but am not sure how to have the movie clip tell the main movie that it is done. Any ideas? Thanks in advance.
[MX04] Movie Clips - Closing Them
Hi there
I have a movie clip (a) and another movie clip (b) inside it which plays when a button is pressed in movie clip (a). How do i get back to first frame of movie clip (a)?
I have a button called 'close' in movie (b) which i'm trying to code so that movie (b) closes and it goes back to the original movie (a).
I'm not doing things right i know and need some help.
Cheers
M
[MX04] Help With Duplicating Movie Clips?
I just went through all of the tutorials in the games sections, and could not find ANYTHING on duplicating movie clips after Flash 4, not even in game things. The only ones I did find were in Flash 4.
So I attacked the idea of duplicating movie clips myself.
I created one frame, with a bullet (A grey paint streak, just imagined it as a... really slow bullet), made it a movie clip, and added the code:
onClipEvent(enterFrame) {
this._x+=5
}
I gave the frame (There is only one frame) this code:
stop();
if(key.isDown(key.SPACE)) {
duplicateMovieClip(bullet, bullet1, 100)
}
This is the listing on the help:
duplicateMovieClip(name,newname,depth)
I have no idea what the depth is for, so I just set it to 100 assuming it was the same as alpha or opacity.
And guess what happened:
The bullet moved like it was supposed to, but nothing happened at all when I pressed space.
All I want to do is have pressing the space bar create a duplicate of that movie clip from it's original position.
Can anyone help me fix this?
ATTENTION: Please do not offer me a free toaster.
[MX04] Backwards Movie Clips
This is what i got so far,
A really freaky man-chick thing flashes on the screen, then it cuts to a clip of 4 guys running down a flight of stairs, then when they get to the bottom of the satires the chick-man thing flashes again, and then what i want to happen is have them run up the steps in reverse. How do i get the movie clip to play in reverse? i used to know,but cant remember how to do it.
Any help would be much appreciated.
[MX04] Removing Movie Clips
I am making a platformer game that calls certain sectors of the level, and loads them when the current sector is off the screen. But when i do this, I use this code to unload the clip when it runs off of the screen. It doesn't do it though.
Code:
function sectorSwap(){
sectorCoords = platform["sector" + (sectorFocus - 1)].getBounds(_root)
if(sectorCoords.xMax <= 0){
platform["sector" + (sectorFocus - 1)].unloadMovie();
}
sectorCoords2 = platform["sector" + sectorFocus].getBounds(_root)
if(sectorCoords2.xMax <= 800){
sectorFocus = sectorFocus + 1;
attachNextSector();
}
}
Will it not unload because I put the movie in with AttachMovie?
[MX04] Buttons And Movie Clips...
Hi Everyone,
I am currently working on a project that I am having trouble with. I've got a navbar and some text. What I am trying to do is when you select "home" the text fades in, then stays there until you select (for example) "about us" which would then fade out the text that was currently there, and then fade in new text. These navbar buttons also have to change the page. What I have done is created a movie clip which has the fading in and out effects for each set of text. All of the appropriate keyframes have the stop action, and all of the appropriate frame labels (or are they called instances, I can't remember). This is where my problem starts. I can get it so it plays the text fading in, and then fading out when another button is selected, but I can't get it to fade the new text in. If there was a way to "pause" the action script I could make it work, but I think I'm out of luck there. The type of action script I'm using is the "on release" and _root.header and gotoandplay ().
Anyways I think that's all, but I'm sure I have missed something important. I can set the .fla online and give you the link if need be.
Thank you for your time, I appreciate it.
~FOX~
[MX04] Buttons Triggering Other Movie Clips
Im using MX 2004 and i was wondering how i could do this:
when you roll over a button it triggers a movie clip to run. The longer you hold your mouse over the button, the longer the MC runs. when you take your mouse off the button the MC stops on that frame.
any advice on how to create this would be great.
thanks
[MX04] Duplicate Multiple Movie Clips
I want multiple instances of the f(x) logo on the screen at the same time. What do you suggest?
http://funkshun.us/banner.xhtml
the f(x) logo is name fxfade_mc and there is one instance placed off the stage
// root frame 1
Code:
function fxfade(){
moviename = random(10);
varrotate = random(360);
varscale = random(120)+50;
xlocation = random(530)+30;
ylocation = random(115)-30;
duplicateMovieClip(fxfade_mc, moviename, 0)
};
setInterval(fxfade, 500);
// inside the fxfade_mc movie on frame 1
Code:
this._xscale = _root.varscale;
this._yscale = _root.varscale;
this._x = _root.xlocation;
this._y = _root.ylocation;
this._rotation = _root.varrotate;
// inside the fxfade_mc movie on last frame
Code:
varname = this.name
if(varname != "fxfade_mc"){
this.removeMovieClip();
}
stop();
[MX04] Preloader, Then Load Movie Clips Help
I am having trouble with the actionscript here. Preloader works fine, then goes to movieclip1 (slide1) which then plays.
But then I want it to play movieclip2, which is an external mc, and then from movieclip2 (slide2) I want it to cycle back to movieclip1 and play.
Can anyone help me with this?
I'm attaching the (not completed and inserted smaller jpegs for the purpose of uploading) file here...
BIG NOTE: There's a third actionscript file you need but it won't let me upload it.
Take the code below and create a file called Preloader.as, save it to the root.
class Preloader extends MovieClip{
private var target_mc:MovieClip;
private var progress_mc:MovieClip;
private var pct_str:String;
private var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
function Preloader(){
// initialize with EventDispatcher so the preloader can broadcast events
mx.events.EventDispatcher.initialize(this);
}
public function startPreload(t:MovieClip){
// set a reference to the timeline that is loading
target_mc = t;
// reveal the preloader clip
this.gotoAndPlay("IN");
}
private function onAnimateIn(){
this.stop();
// this is called from the preloader mc timeline on the last frame of the 'in' animation
// starts checking the load progress of the target movie clip on each frame
this.onEnterFrame = this.checkLoadProgress;
}
private function checkLoadProgress(){
// get the total bytes and the loaded bytes of the target clip
var bl = target_mc.getBytesLoaded();
var bt = target_mc.getBytesTotal();
// calculate the percentage of bytes loaded
var pct = bl/bt;
// get the current frame and total frames of the progress clip
var cf = progress_mc._currentframe;
var tf = progress_mc._totalframes;
// calculate the frame that corresponds with the load percentage
var f = Math.ceil(tf * pct);
// if the current frame of the progress mc is less than the value of f then let the clip play
// otherwise, stop the progress clip to wait for f to catch up with the current frame
// this prevents the animation from jumping ahead if the target clip is loading faster than
// your progress animation
if(f > cf){
progress_mc.play();
}else{
progress_mc.stop();
}
// set percent display in preloader_mc based on percentage of frames that have played
this.pct_str = (Math.round(cf/tf * 100)).toString();
// if the clip is entirely loaded, and the progress clip has played all the way through
// then the preloading is complete
if(bt > 20 && bl == bt && cf == tf && progress_mc){
onPreloadComplete();
}
}
private function onPreloadComplete(){
// stop the check load call
this.onEnterFrame = null;
// animate the preloader
this.gotoAndPlay("OUT");
}
private function onAnimateOut(){
this.stop();
// dispatch event that tells any listeners that the preloader is done
dispatchEvent({target:this, type:'onPreloaderOut'});
}
}
[MX04] Looping Multiple Movie Clips
Hello all-
I am creating an ad/header graphic for a web site. I have 7 movie clips that I need to rotate through. They are pretty basic movie clips, picture fades in, text fades in, pauses for 15 seconds, then needs to move on to next movie clip. There's where my problem lies.
I have it set up on Scene 1, where I have movie clip 1 as a layer 1, movie clip 2 as layer 2, movie clip 3 as layer 3, etc. When I preview it, only movie clip 1 plays and then it repeats itself. It never makes it to the next movie clip. Is there some action script that I can put in to make it jump to the next movie clip? Is there an easier way to do this, or do I need to create one long movie clip that includes all 7 movies?
Thanks!
Kauzmo
[MX04] Loading Multiple Movie Clips
I have a movie that I am trying to load two other movies into. One is a nav and the other a looped movie sequence.
I created two empty movie clips in the main movie clip:
mcLoader and mcLoader2
on an actions layer I have:
mcLoader.loadMovie("MovieClips/nav2.swf");
mcLoader2.loadMovie("MovieClips/ex1.swf");
Neither file loads or the first loads if I remove the second. The movies are in teh right folders. I'd appreciate some hints. I'm sure I'm missing something but I've been looking at this forever. Thanks in advance for any advice, I appreciate it
[MX04] The Same Random Frame In Two Different Movie Clips
Hi, I'm a student at university and I frequently work with flash MX 2004. I'm currently working on a project that involves many characters on screen at once. only as a twist, I wish to have them scripted so that they all look different every time the swf is played.
for example, I have the head working. when the character is loaded into the frame, a random face, hairstyle and hair colour is chosen and works every time.
however what I'm stuck on is the rest of the body. I can easily set every body part at random but that will result in a bunch of characters wearing multicoloured clothing. each body part of the character is a seperate movieclip embedded into one movieclip.
right now, so that I can get a feel of it, I'm working on the shoes. I want the style of shoe to be random but i want both shoes to come out the same. initially my idea was that I have the random script on one shoe and then use script on the right but all my ideas fall short. here is what I have so far:
on the left shoe:
onClipEvent (load)
{
gotoAndStop(random (6));
}
and then on the right shoe:
onClipEvent(load)
{
gotoAndStop ((zombie.foot1.shoe1.currentFrame));
}
that was my first idea, I also thought about having:
this.currentFrame == zombie.foot1.shoe1.currentFrame;
and also the same only with currentFrame replaced with frameNumber.
this is the best that I can explain it. if people need me to go into more detail I'll be happy to.
any help would be great as I'd really love to get these things working
[MX04] Load / Unload Movie Clips
I am loading external SWFs on my main flash file.
For every External SWFs:
They also have multiple levels. There is a base SWF and then 5 levels of other external SWFs there.
So- i load an external SWF on my main flash and that external SWF also has its own external SWFs.
This is how i do that:
on my main flash file.. i create a blank MC:
this.createEmptyMovieClip("blank1", this.getNextHighestDepth());
Now, by default i load my first external MC there (ExtMC1)
_root.blank1.loadMovie("ExtMC1.swf");
Now i have a button (Button2) and when it should be clicked- it should replace ExtMC1 with ExtMC2.
_root.blank1.loadMovie("ExtMC2.swf");
This just don't work because it does replace the base file for ExtMC1 but the external SWFs within ExtMC1 remains on the main flash file..
so i use this instead:
button2.onRelease = function() {
unloadMovieNum(1);
unloadMovieNum(2);
unloadMovieNum(3);
unloadMovieNum(4);
unloadMovieNum(5);
_root.blank1.loadMovie("ExtMC2.swf");
};
so basically i clear all the levels first and then load my second MC (ExtMC2.swf).
similarly to load my third MC i use this on button 3:
button3.onRelease = function() {
unloadMovieNum(1);
unloadMovieNum(2);
unloadMovieNum(3);
unloadMovieNum(4);
unloadMovieNum(5);
_root.blank1.loadMovie("ExtMC3.swf");
};
is there any better way of doing the same- it does work but the issue is, when the first MC (ExtMC1) is loading and click on the button 2 to load the second MC (ExtMC2) - it takes a lot of time.. so i need an effective way of doing the same.. please help.
[MX04] Changing Attributes Of Movie Clips In Other Frames
Hi there,
I have a problem in changing an attribute of a movie clip (in frame 1) using an on(release) command from a button in another frame(frame 2).
I have adapted an example in the attachment for this post. Notice the code on frame 2 button doesnt work.
Any help appreciated.
Thank You
Scrolling Multiple Movie Clips Simultaneously [MX04]
hello all...
i have a fairly complex question:
i'm building a gallery. there will be one main page with thumbnails, each representing a sub-gallery. what i've done is construct 11 separate _mc's so that onRollover, the thumbnail fades in from 40% to 100% _alpha and a line of text appears underneath the thumbnail. then, onRelease, each thumbnail acts as a button to gotoAndPlay another frame on the main timeline. each sub-gallery will occupy one frame on the main timeline and jpegs will be loaded from an external XML file. this part works fine.
now, what i'd like to do is somehow "group" the 11 _mc's on the main gallery page so that i can have them scroll from left to right simultaneously onRollover, possibly using a mask or invisible button. they are each 150px wide, so they don't all fit on the stage and there will eventually be MORE _mc's, each representing new sub-galleries.
what is the best way to do this?
i've done a lot of searching for tutorials on horizontal scrolling for jpgs and galleries, but i haven't been able to find something similar for _mc's. is there a way to do this dynamically (e.g. load the _mc's into another _mc?) i started reading a bit on nesting using the attachmovie() function, but it seems like that only loads one _mc per level, using the main registration point. i want all the _mc's side by side, spaced evenly, so they scroll in unison. also, i'm not sure if having two onRollover events will cause a conflict.
any help or suggestions would be GREATLY appreciated...
THANK YOU!!!
[MX04] Movie Clips - Drag N Drop Sensitivity
Greetings,
I'm experiencing problems with rectangular shaped move clips with the registration point set to the default 'center'.
They seem to be very sensitive when the mouse hovers over them to change shape to allow them to be dragged, suprising since they are of a such flat shape and not incredibly small.
Its best described as not very user friendly!
Is there anything I can do to improve/resolve this issue?
Anyone else experienced this?
Attached code to the movie clip to allow them to be dragged, also experiment with true/false value in startDrag params.
Code:
on(press) {
startDrag(this,true);
}
[MX04]Creating Functions For Pre-existing Movie-clips
Hello,
This is my third thread on these forums and in my previous threads I had always got some help.Well, now I have another serious problem, can you help me?
I am unable to create a function that can control movie clips. Let me explain:-
I have 10 movie clips on the stage and I have assigned them that whenever they crash to an object, they will go to a random position. Writing this code ten times for each movie clip would be very tedious, so, I thought about creating a function, but, it doesn't work. Here's the function, can you correct it?
Code:
var object:movieClip;
function position(object) {
var testnum1:Number;
testnum1 = random(290)+36;
_root.object._y = -77.6;
_root.object._x = testnum1;
}
position(nameofmovieclip)
PLEASE HELP IS REQUIRED!!!!
Thanking All,
Chinmaya
[MX04] Duplicating/Creating Instance Of Movie Clips
Greetings,
Im WIP in creating a game which has movieclips (bullet and live symbols) dotted on the stage but not in the visible runtime view.
These movieclips are then duplicated when required. The bullets have code attached to the movieclips however the lives symbols don't.
Is this common practise to have movieclips hidden offscreen and then duplicated to create an instance when required or is their a cleaner method to create an instance of a movieclip?
Hope that makes sense.
Thanks
Rob
[MX04] Problems Using Drop Target With Nest Movie Clips
Hi !
I wonder if anyone can help me solve this bit of code i'm having problems with..
I'm working on a site that will have a panel that can be dragged from the botttom of the screen. the panel includes navigation and data from an xml file. i have made this and called it info_mc.
the first time i created it, i realised that making info_mc the draggable item meant i lost my buttons in the panel, so i created another movieclip called drag_mc and place it in info_mc.
Theorising that when you pressed on drag_mc it would drag info_mc with it. after much tinkering with the script i got this to work as i wanted. ( when you drage it up it slides up and when youo release it slides back down out of view.
I now want to put a drop target so that when it is dragged over the target it will stick, at present the droptarget doesn't work. I've done this before but not with an embedded drag_mc . below is the script as it is at present. i'm sure the problem has something to do with the paths to drag_mc, info_mc and circleTarget. but have not been able to fix it.
The elements are laid out as so:
main timeline contains - circleTarget, info_mc
info_mc contains - Drag_mc, script for dragging (see below)
circletarget contains - 2xkeyframes with script stop(); in each.
you can see a mock up of the flash movie and download the FLA here:
http://www.bru-ha.com/flashdemo/drangndrop
http://www.bru-ha.com/flashdemo/drangndrop.swf
Here is the script info_mc that should do all the dragging and dropping.
code:
drag_mc.onPress=function(){
startDrag(_root.info_mc,true,_x,580,_x,0)
}
drag_mc.onRelease=drag_mc.onReleaseOutside=functio n(){
stopDrag();
if (_root.info_mc._droptarget == "../targetCircle") {
_root.info_mc.onTarget=true;
_root.targetCircle.gotoAndStop(2);
}else{
_root.info_mc.onTarget=false;
_root._parent.targetCircle.gotoAndStop(1)
}
}
//sets function on embedded drag button to drag info_mc
//the variables below will store the clips starting position
_root.info_mc.myHomeX=_root.info_mc._x;
_root.info_mc.myHomeY=_root.info_mc._y;
drag_mc.onMouseDown=function(){
//this variable tells us if the mouse is up or down
mousePressed=true;
}
drag_mc.onMouseUp=function(){
mousePressed=false;
}
drag_mc.onEnterFrame=function(){
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)
if(mousePressed==false&&_root.info_mc.onTarget==fa lse){
_root.info_mc._x-=(_root.info_mc._x-_root.info_mc.myHomeX)/5;
_root.info_mc._y-=(_root.info_mc._y-_root.info_mc.myHomeY)/5;
}
}
I hope someone out there will be able to help me, or give me some advice...
best
Andy
[MX04] Actionscript Communication With PHP?
I have a page built in PHP with a variable to specify which type of user is logged in. For instance, say in my PHP I ave x=0 if the user is a regular user, and x=1 if they are an admin. I also have a Flash menu on the page.
Essentially, I want to display different menu options on the Flahs menu for users and administrators. I have 2 different scenes, where scene 1 shows the user menu and scene 2 shows the admin menu, and I want to be able to just check the value of the variable to determine which scene to display... however, I do not know how to fetch this PHP variable from within my Flash movie... can this be done?
Communication Between External .swf's [mx04]
Hi everyone, wondered if I could ask for some advice and help?
Say I am making a website that contains a flash movie which is pulling external flash movies into it, is it possible for two external movies to communicate with each other when they are brought together this way? For example:
Main clip calls in clip1.swf, and clip2.swf from an external source.
Upon an action in clip1.swf I would like to load a further external movie into an empty movieclip contained within clip2.swf.
How would I write the syntax for the target path to achieve this?
How To Remove All Movie Clips/array: Movie Clips Carry Over To Next Frames/ Scenes
Hi: I am creating a small game. So far so good, but only problem I have come across is when I jump to another frame or scene, previous movieclips (using an array) that are still running carry over to the next frame/scene.
See attached if you have some time- start clicking on answers in the game, and when time runs out some movie clips that are still running will remain on top of my end frame and carry over to the next scene as well.
Is there any sort of remove all movie clips or "clear all" type of actionscript?
thanks in advance!
[MX04] Stop All Child Clips
Hi,
I have lots of child clips within one main movieclip, and I need to stop all the child clips. I don't want to put a line of code to stop each child clip separatly, so how do I do stop them all in one go? I'm sure there's a way.
Thanks
[MX04] Invisible Move Clips Are Still Being Counted
Hi Everyone,
I have a problem with my coding which no one in my class even my teacher can figure out.
I am making a game for the Culminating Activity and what it is is that the player is the frog's tounge and it tries to get bugs,
I have a specific bug (Bug6) that when its "eaten" [gone invisible] subtracts to from the hit count.
Except it doesn't move leave but is invisible so, everytime the tounge goes down my hit count is subtracted by a huge amount!!
Here's the code:
if ((this.hitTest(_root.Bug1))) {
trace("hit bug 1");
_root.Bug1._visible = false;
_root.btmVal = _root.btmVal+1;
_root.Bug1._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug2))) {
trace("hit bug 2");
_root.Bug2._visible = false;
_root.btmVal = _root.btmVal+1;
_root.Bug2._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug3))) {
trace("hit bug 3");
_root.Bug3._visible = false;
_root.btmVal = _root.btmVal+1;
_root.Bug3._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug4))) {
trace("hit bug 4");
_root.Bug4._visible = false;
_root.btmVal = _root.btmVal+1;
_root.Bug4._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug5))) {
trace("hit bug 5");
_root.Bug5._visible = false;
_root.btmVal = _root.btmVal+1;
_root.Bug5._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug6))) {
trace("hit bug 6");
_root.Bug6._visible = false;
_root.btmVal = _root.btmVal-2;
_root.Bug6._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
if ((this.hitTest(_root.Bug7))) {
trace("hit bug 7");
_root.Bug7._visible = false;
_root.btmVal = _root.btmVal+5;
_root.Bug7._y = 10;
trace("added one");
_root.zap.start();
trace("sound play");
}
Thanks for your help,
it's much appreciated!!
Maintaining Event Behavior For Movie Clips Nested In Movie Clips
Is there any way to maintain a clip's event callbacks when said clip is nested in a parent clip that has its own definitions for those callbacks?
In other words, if clip B has a definition for .onPress and clip A has a definition for .onPress, is there anyway to maintain clip B's definition if it is nested in clip A?
I have tried doing it by making clips into movie clip subclasses but it doesn't work... but how do components work then?
[MX04] Ok, Feeling Stupid. Need Some Help With Formula To Position Attached Clips M
it doesn't seem that hard (and i know it isn't, I''m just too retarded to figure it out for some reason. (first a little background.. ok XML gallery, with small btns/thumbs. the number of thumbs attached is dependent on the number of nodes/tags in the XML file. I have no problem with any oif this.) What i can't seem to get right, is a way to attach say.. 6 or 8 mc's across, then drop down a bit on the stage, move back to the left, and generate the next 6-8 thumbnails, and so on, until there's a thumb/btn for each entry in the xml file.
All i'm trying to do, is make a properly placed grid of thumbs/btns.
i can create a grid of duplicated mc's :
Code:
var col = 6;
var row = 10;
var pad = 2;
var depth = 1;
for (r=0; r<row; r++) {
for (c=0; c<col; c++) {
duplicateMovieClip(mc, "mc"+depth, depth);
mc._visible = false;
this["mc"+depth]._x = c*(mc._width+pad);
this["mc"+depth]._y = r*(mc._height+pad);
depth++;
}
}
but for some reason, i can't seem to do it with attaching clips... I just can't get the math right to jump down N px to next row after i've created 6 or 8 across...
Code:
var pNMBR:Number = 0;
var i:Number = 0;
var j:Number = 0;
var pad:Number = 2;
var PROJECT_XML = new XML();
XML.prototype.ignoreWhite = true;
PROJECT_XML.onLoad = function(success) {
if (success) {
PROJ_DATA = PROJECT_XML.firstChild;
pNMBR = PROJ_DATA.childNodes.length;
// some crap that isn't needed for this post goes here...
setup(); // then i run the setup function...
// then there is some MovieClipLoader nonsense here...
}
};
PROJECT_XML.load("content/gallery.xml");
// DELAY THE ANIMATION OF THUMBNAILS
function pauseMe(clip, time) {
wait = time*400;
go = function () {
clearInterval(waiting);
clip.gotoAndPlay("_scale");
if (clip == mc0) {
mc0.gotoAndPlay("_viewed");
}
};
var waiting = setInterval(go, wait);
}
var cols:Number = 6; // number of columns
// CREATE THUMBS...
function setup() {
for (j=0; j<=pNMBR; j++) {
var _mc = attachMovie("mc", "mc"+j, j);
pauseMe(_mc, j);
_mc.thisNum = j;
_mc._y = 315;
_mc._x = j*(_mc._width+pad)+25;
var thmb_holder = t_hold.createEmptyMovieClip("thmb_holder"+j, j);
if (j>cols) {
_mc._y = 315+(_mc._height+pad);
_mc._x = (j-cols)*(_mc._width+pad)+25;
}
}
}
I don't want to have to check: if (j>cols) {.... and then : if (j>cols*2) {..... and then : if (j>cols*3) {.... and so on and so on... can someone please give a arithmetically challenged kid a hand??
THanks
[MX04] Positioning Clips With Equal Spacing On Resizable Stage?
ok.. this one has got me..... I've been trying every different combination i can think of.
I'm attaching clips with a for loop, and after attached they slide into their proper place.
I CAN attach them and space them equally along the x-axis. What i can't seem to do, is attach the clips, and have them move to positions that are equally spaced apart from each other, AND ALSO CENTERED on the stage. Then calculations would also have to adjust with the Stage.onResize handler so they are always evenly spaced and centered. I should probably mention that the clips have a centered registration point as well.
For example, if i attach 4 clips, which have a width of 100, and my Stage.width is, say 700px.... how can i place the 4 clips an equal distance apart from each other, say 20px, and then have the group of the four clips centered on the stage?? (placing them inside another movieclip is not an option)
They also need to retain the even spacing, and stay centered if i resize the stage up or down....
Any thoughts?...
This will give you an idea of what i'm working with currently (the boxes will scale to various sizes eventually):
http://artofficialintel.com/flash_te...ring_menu.html
How Do I Load/stream Individual Movie Clips Within Other Movie Clips
I am using flash 5
I have a movie with a huge movie clip in it and that movie clip has lots of movie clips inside that. how do I load each one individually so when the viewer clicks on abutton it starts to laod the related movie clip.
Please help.. I'm working on borrowed time and borrowed money
Movie Clips Within Movie Clips: Text Link Problem
Hello.
I have a Movie Clip that is my main one with another Movie Clip inside of it. In the subordinate Movie Clip, I wish to have text linking frame (13) to frame (14) for instance. The problem that manifests is that while buttons is the subordinate Movie Clip link to frames within it with no complications, the text link from 13 to 14 with its respective code links to the last frame (would be 14) in the main Movie Clip.
Am I doomed to convert all text links to buttons in the subordinate Movie Clip or is there (what I am praying for) a code to work around this and keep frame links confined to the subordinate Movie Clip? I would appreciate any help that anyone can offer regarding this problem. Many Thanks.
Movie Clips Acting As Buttons Can't Load Other Movie Clips
Frame 1 has three movie clips on it, instance names are A, B, C. I have the following actionscript on frame 1 as well:
stop();
import flash.filters.GlowFilter;
ar = [A, B, C];
for(var z=0; z<ar.length; z++) {
ar[z].onRollOver = rollover;
ar[z].onRollOut = rollout;
}
function rollover() {
this.swapDepths(0);
this.filters = [new GlowFilter(0x333333, .20, 7, 7)];
}
function rollout() {
this.filters = null;
}
This code creates a glow, obviously, on whatever movie clip I rollover. What I want to do as well is this:
I want to click on mc "A" and have it launch a different movie clip (let's say "X") on top of everything else (so that A, B and C are still visible in the background). "X" is in a sub-folder of "A" if that makes any sense or is relevant. Same kind of action for mc's B and C. B should launch mc "Y" and C should launch mc "Z".
What is the actionscript for this? Any questions please let me know. Please respond, I need this info as soon as possible. Much appreciated!!
Text
External Movie Clips With Multiple Menu Movie Clips
It's pretty late and I don't think i have enough time to search this question in the forums but here I go. Sorry If I upset someone for making a topic that already exists.
I have a main timeline that im importing an external movie clip in. This external movie clip is named "members" it has several buttons that load other external movie clips into a window within "members" . What do I need to do to make this work. Do I need to use "this, _parent, _root, level(s) or "whatever.swf". If you can help me out that will be great. I'll make it up to you down the road. No sexual favor please.
I'm using flash mx 2004 btw.
Thanks in advanced
Communication Between Loaded Movie And Parent Movie?
Hi all
Is it possible to communicate (send variables) between a loadedMovie and its parents movie in flash?
If so, can you give me any tips on how to do this?
e.g.
how could I change the contents of a variable of the parent movie from the loaded movie?
_root.variablename = "duh"; only goes back to the root of the loadedMovie
any ideas?
Cheers
Movie Communication With One Another
first off...
please download the attach files because this may get confusing...
about box.fla is the main project to look at
i have a window that reveals text and a menu of buttons on the right. the first text that appears is called ' about ', then each button has its own text that is loaded when the button is clicked on. i also have a button on the top left that hides the whole window, including the text.
menu looks like this:
about
profile
cv
lectures
awards
credits
my problem comes in when i have of the other buttons text in the window, for example, 'cv' window of text is open but when i click on the top left button and the window hides and i click that button again the 'about window of text reopens, i would like for the button on the top left automatically read/know which one of the menu buttons is open and reopen that particular window, instead of just the 'about' window.
Movie Communication With One Another
first off...
please download the attach files because this may get confusing...
about box.fla is the main project to look at
i have a window that reveals text and a menu of buttons on the right. the first text that appears is called ' about ', then each button has its own text that is loaded when the button is clicked on. i also have a button on the top left that hides the whole window, including the text.
menu looks like this:
about
profile
cv
lectures
awards
credits
my problem comes in when i have of the other buttons text in the window, for example, 'cv' window of text is open but when i click on the top left button and the window hides and i click that button again the 'about window of text reopens, i would like for the button on the top left automatically read/know which one of the menu buttons is open and reopen that particular window, instead of just the 'about' window.
External Movie Communication
I need help with buttons in external movies loaded in the main movie. I don't know how to make the buttons in external movies affect the main movie. Go to the link below for a clearer explanation.
http://www.tmny.com/flash_help/external_movies.html
Thank you in advance.
Movie Communication OnRollOut
hello.
i am having trouble making 2 movies communicate with one another.
one movie (series) is embedded into the other (content2).
'content2' is a horizontal scroll menu of images. series is a movie that
holds 'content2' and contains a mask which will reveal everything upon
the rollover of the 'series' button. i can get the scroll to show and work
when the button is rolled over but it fails to hide on roll out.
here is the code i have used on the roll over button called 'series':
Code:
stop(); // stop the movie clip from playing (stop button from growing, we want that when the mouse rolls over only
sym2.onEnterFrame = function(){
if(rewind == true){ //if rewind switch is set to true play backwards
prevFrame(); // play backwards
}
}
sym2.onRollOver = function(){
rewind = false; //set variable (or switch) that decides wether ot not to play backwards...
play(); // play this movie clip.. (grow the button(tween));
if (_root.start_mc.navigation._visible == 0) {
_root.start_mc.navigation._visible = 1;
} else {
_root.start_mc.navigation._visible = 0;
}
}
sym2.onRollOut = function(){
rewind = true; //set or rewind switch to true so it will play backwards...
if (_root.start_mc.navigation._visible == 1) {
_root.start_mc.navigation._visible = 0;
} else {
_root.start_mc.navigation._visible = 1;
}
}
again, the roll out function isn't working. can someone please help me. the .fla is attached.
thank you.
External Movie Communication
This is probably a stupid question, but I will give it a try:
I want to create a button in an external movie that can communicate with the movie that it is loaded into. In other words:
I create a main movie.
I create an external movie with a button that I want to communicate with my main movie.
I load that movie into the main movie by using loadMovieNum()
Now, how do I make that button in the external movie communicate with the main movie?
Thanks in advance for anyone who can offer some assitance.
Movie Clip Communication
Hi to everyone
I'm really stucked with action script.I'm new so i don't have that much experience in programming.
So the problem is the following:
Imagine that i have my _root scene and many layers.In every layer there is only one button or one movie clip.
The problem is with movie clips.The movie clips are used as buttons but i made them movie clips because they include many animated geometrical objects and sounds. So in redcircle_mc (for example) there 10 different layers and every layer is a different geometrical object. For redcircle_mc follows this simple script:
on (press) {
gotoAndPlay (2);
}
So the movie clip starts. In the first frame of movie clip's timeline i have a stop(); so that doesn't start automatically. And in the last one another stop(); because i don't want this to be looped.
That works fine no problem.
The question is : what should i do when an animated object (of the movie clip) starts but in a point i want to stop his movement by pressing the mouse, and don't let it to continue his prearranged motion? But the other objects should continue their prearranged motion.
I don't seem to understand the thinking of the programming.
Propably i have to convert this object to movie clip and then??
I've tried to do this and then on this new movie clip tried to write:
on (press) {
startDrag (this, true);
}
on (release, releaseOutside) {
stopDrag ();
}
but it doesn't work. I miss something.
Please can someone help me?
Movie Clip Communication
I have a situation with movie clip communication. On the main timeline, I have a movie clip with an instance name of newsBG. Nested inside newsBG is another movie clip, which starts on frame 15 called newsDD. This nested clip plays to frame 15 too and then there is a button with a function that plays a closing animation. On the final frame, I'm trying to write a script that tells newsBG to start playing from frame 16 again. Here's what I've tried so far:
this.newsBg.gotoAndPlay(16);
Code:
this.newsBg.gotoAndPlay(16);
This throws the following error:
1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.displayisplayObjectContainer.
Communication With Loaded Movie
Hey everyone.
My most recent project requires that I link external movies through a main movie and exercise some degree of control over them.
Currently I have a button ("open") that loads a movie into an existing movie clip. A secondary button tells the MC in which the movie was loaded to go to a frame labeled "close". I am not sure if telling the MC inwhich the movie was loaded will automatically advance to telling the loaded movie to go to the specified frame, or if I am telling the movieclip to do it. How do I communicate with the movie within the movieclip?
The movieclip is named "ContentClip"
The example external movie is "contact.swf"
This is what is attached to the movie clip. I know the buttons work as I can see the movie load and display on screen. only when I try to control the movie does it not function.
Code:
with (_root.ContentClip) {
gotoAndPlay("Close");
}
Flash Movie Inter-Communication
I have a flash movie that I will have displayed multiple times on a page. Within the file I have opened a socket connection for data streaming. However, I would prefer to use the same connection in all my files instead of having one for each instance of the movie. Is there a way to get it to use one or is there a way for one to get the data and then for me to pipe it to the others?
|