MOVIECLIP SLIDESHOW
Hi, I am trying to create a slideshow that has a 'next' and 'previous' button, which lets you see the next or previous movieclip when you click one of the buttons. I have done the 'next' button but cannot do the 'previous' button, please can someone help!! Also, I would like the next button to disappear when you are at the last image, and the 'previous button' to disappear when you are on the first image. I have attached the code I have created so far.Thanks alot!!Attach Code//index the imagesvar aImages:Array = new Array(mcGreenfield, mcMillstock, mcSplash, mc1estateagency, mcCarlton, mcPrestige);var nCurrentIndex:Number = 0;//tell flash how it can call fadeImage function on an intervalvar nInterval:Number;//next buttonmcNext.onRelease = function():Void {clearInterval (nInterval);//call fadeImage function on an intervalnInterval = setInterval(fadeImage, 50, aImages[nCurrentIndex]);};//reset buttonmcReset.onRelease = function():Void {for (var i:Number = 0; i < aImages.length; i++ ) {aImages[i]._alpha = 100;}//when reset,show first imagenCurrentIndex = 0;};function fadeImage(mcImage:MovieClip):Void {//decrease the alpha of the imagemcImage._alpha -= 10;//check if alpha is 0, then clear interval and show next imageif (mcImage._alpha <=0){clearInterval (nInterval);nCurrentIndex++;}updateAfterEvent();}
Adobe > ActionScript 1 and 2
Posted on: 06/18/2008 01:40:38 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Movieclip Slideshow Problem
Hi guys....
I have a flash file that loads another flash file that is an automatic slideshow.
In the slideshow file I have placed all my images in a movieclip and placed some script on the movieclip to make it pause on each image for a certain amount of time.... script:
onClipEvent (load)
{
_root.myInterval = 0;
}
onClipEvent (enterFrame)
{
_root.myInterval++;
if (_root.myInterval > 300) {
_root["myClip"].play();
_root.myInterval = 0;
}
}
When I run my holder swf, it pauses on the image but doesnt carry on to the next image, it just stops...
Help.
pdue
A Dynamic Movieclip Slideshow?
I am looking for a way to create a dynamic drag and drop slideshow builder.
I am proficient in Flash but not much of a programmer so heavy actionscript is a bit out of my league although I am understanding enough to modify.
Scenario:
The SWF will contain six placeholders (a timeline) and six drag and drop images representing the separate movie clips.
You would drag each image onto a placeholder of your choosing in whatever order you want. Then proceed to hit a play button.
This would trigger a slideshow to play each movie clip in the sequence specified. Now, depending on the order you put them in, a specific
audio file would be played over each one with corresponding text being displayed as well. Each of the six images could have 6 different sound clips, the one that plays is dependent on the place holder it is placed on.
So, you would have 36 movies to call to in the whole thing. 6 possibilities for each placeholder.
Anyone point me in the right direction? Is this crazy difficult? Are my eyes bigger than my stomach!
A Dynamic Movieclip Slideshow?
I am looking for a way to create a dynamic drag and drop slideshow builder.
I am proficient in Flash but not much of a programmer so heavy actionscript is a bit out of my league although I am understanding enough to modify.
Scenario:
The SWF will contain six placeholders (a timeline) and six drag and drop images representing the separate movie clips.
You would drag each image onto a placeholder of your choosing in whatever order you want. Then proceed to hit a play button.
This would trigger a slideshow to play each movie clip in the sequence specified. Now, depending on the order you put them in, a specific
audio file would be played over each one with corresponding text being displayed as well. Each of the six images could have 6 different sound clips, the one that plays is dependent on the place holder it is placed on.
So, you would have 36 movies to call to in the whole thing. 6 possibilities for each placeholder.
Anyone point me in the right direction? Is this crazy difficult? Are my eyes bigger than my stomach!
Slideshow Movieclip Problem
Hello everyone!
I'm trying to make a slideshow but I'm having problems with movieclips in the main film...
If say I have 40 frames in my film and I place a movieclip in frame 20, the main film has to stop at frame 20, play the movieclip and then automatically go play frame 21 and onwards in the main movie...-I figured to put a stop action on frame 20 (in a separate actions layer) but how do I make the movie play the clip and go back and play the rest of the main movie??....-do I need an actionscript or a behaviour?...-I don't want it to be controlled by buttons....-yes, U guessed it; I'm such a beginner at Flash, so I'm adressing all U Flash heroes out there for help!
PS: laughing at these simple issues is allowed!
/beginnersluck...-yeah right!
Kirupa Slideshow With Second Movieclip
Hi all,
I have been practicing on the Kirupa Slideshow. I am currently trying to add a second movieclip so two images show at once.
I copied the original mc, renamed it to Picture2, created a new XML node <image2>, and then generally duplicated the code for the Picture mc. As a test, I renamed the new mc with the original mc name and it appears to have worked, so I guess I am missing something somewhere........
I have attached the fla if someone with a little more skill than I could have a quick look at it to see where I have gone wrong. That would be nice.
thank you
suede
Slideshow With Movieclip Transition
i'm trying to modify the xml slideshow code. i've done some searching, but haven't really found an answer for what i'm looking for.
instead of adjusting the alpha property for a fade out transition, i'm trying to use a movieclip to create a flashing transition between photos. i'm basically trying to achieve an effect similar to the one on the photo slideshow in the header of this page. i tried to use attachMovie, but i couldn't get that to work the way i wanted it to. i've got this effect working right now by just setting movieclip.play(); in the nextImage function, but is there a better way to do it? i'm suspecting that this is possibly eating up memory, so if there is a more efficient way to do this, or if i'm doing it wrong, i was wondering if anybody could point me in the right direction.
here is my code:
Code:
var delay:Number = 4500;
//flashmc.stop();
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].attributes.url;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/*listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};*/
var p:Number = 0;
//var p:Number = Math.floor(Math.random()*total);
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
//picture._alpha = 0;
picture.loadMovie(image[p], 1);
picture_num();
slideshow();
flashmc.play();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
//picture._alpha = 0;
picture.loadMovie(image[0], 1);
picture_num();
slideshow();
flashmc.play();
//attachMovie("flashmc", "picture", 1);
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
Movieclip In XML Slideshow Question
Hello,
This question is a followup to another question of mine which was answered a couple weeks ago...
I have an XML slideshow that is self-playing, but can skip from slide to slide with a previous button, a next button, and 5 individually numbered movieclip buttons that represent each slide in the gallery. I would like the movieclip buttons to change state when their particular slide is active. For instance, if the user is on slide 2, I'd like the movieclip for slide 2 to be highlighted (I've created each of the movieclip buttons to have only two frames, one the 'on' state and the other an 'off' state. No tweening is necessary.)
How do I go about doing this?
Below is my actionscript (ql1,ql2,etc. are my movieclip button instances)
Code:
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
var captions:Array = new Array();
var whatIsCurrent:Number;
x.onLoad = function() {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].firstChild);
}
holder.loadMovie(urls[0]);
caption.htmlText = captions[0];
whatIsCurrent = 0;
};
x.load("articles.xml");
previous.onRelease = function() {
if (whatIsCurrent>0) {
whatIsCurrent--;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
} else {
whatIsCurrent = 4;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
}
};
next.onRelease = function() {
if (whatIsCurrent<urls.length-1) {
whatIsCurrent++;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
} else {
whatIsCurrent = 0;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
}
};
ql1.onRelease = function() {
clearInterval(myInt);
whatIsCurrent = 0;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
};
ql2.onRelease = function() {
clearInterval(myInt);
whatIsCurrent = 1;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
};
ql3.onRelease = function() {
clearInterval(myInt);
whatIsCurrent = 2;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
};
ql4.onRelease = function() {
clearInterval(myInt);
whatIsCurrent = 3;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
};
ql5.onRelease = function() {
clearInterval(myInt);
whatIsCurrent = 4;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
};
// For playing and pausing and the like
var autoAdvance:Boolean = true;
var myInt:Number = setInterval(nextSlide, 3000);
function nextSlide() {
if (whatIsCurrent<urls.length-1) {
whatIsCurrent++;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
} else {
whatIsCurrent = 0;
holder.loadMovie(urls[whatIsCurrent]);
caption.htmlText = captions[whatIsCurrent];
}
};
playPauseBtn.onRelease = function() {
clearInterval(myInt);
if (autoAdvance) {
autoAdvance = false;
}else {
autoAdvance = true;
myInt = setInterval(nextSlide, 3000);
}
}
Thank you for your help.
SWF/movieclip Random Timed Slideshow
Basically I need help creating a slideshow that loads .swf or movieclip files, randomly and for a small period of time (i.e. 10-15 seconds) then changes. Also be able to have back and forward buttons. You can e-mail me at nabilkazerouni@yahoo.com
MovieClip Slideshow+XML W Dynamic Text
http://i61.photobucket.com/albums/h7...deShowinMC.jpg
Anyhelp anyone? This is the closest thread I came to achiving this..
http://www.gotoandlearn.com/forum/vi...asc&highlight=
but no fla to see visuals while creating in the process..
any help?
Slideshow Sequence Problem When Loading More That 1 Movieclip
hello chaps, can someone help with this problem, I've tried for 2 days but can not find any mistakes.
Scenario:
I have my main animation site.swf which loads the menu.swf The menu.swf loads a different slideshow (thanks Kirupa) for each button pressed (currently I only have the 'home page' and 'the hotel - location' button working) using
Code:
on (release) {
if (_global.current_page != "home"){
_root.holder.loadMovie("slideshow1.swf");
trace("the movie should have loaded");
_global.current_page="home";
}
}
for the homepage button and
Code:
on (release) {
if (_global.current_page != "location"){
_root.holder.loadMovie("slideshow2e.swf");
trace("the movie should have loaded");
_global.current_page="location";
}
}
for the hotel-location button.
It all looks fine, I'm pleased with the direction i'm going with (considering this is my first venture into doing a full flash site). take a look at http://www.webdesco.com/hwtb/site.html
Problem:
if you click on home page, then click on 'the hotel - location', then back onto home page and then back onto 'the hotel - location', and do so again several more times the slideshow skips some of the images and does not fade some of them in, in general it gets completely screwed up!!!! The same thing happens in both IE6 and firefox (both have flash9 plugins)
Solution:
Well thats where you guys come into play, coz i'm clueless!!!!! (thanks ;-))
the whole site is included in a zip file too big to attach to this post so it can be found at http://www.webdesco.com/hwtb/site.zip , if you play the site movie through flash you will see the traces of the files being loaded and you should see the files being skipped!!
Thanks alot for reading this, thanks more if you can help, I'll be your sex slave or whatever if you can solve this!!!!(only kidding about the sex slave thing )
cheers
Philip
Problem Linking Thumbnail Buttons To Photo Slideshow Movieclip
I have a series of thumbnail buttons in a vertical strip that slides up and down when you roll over it. when each button is clicked i want it to play a movie clip that shows a larger version of the image. i've tried everything but it's not working.
there is an auto slideshow that is running all the time until a thumbnail is clicked and then it will show the related image in the space where the slideshow was originally.
how do i get the buttoins withtin the picturestrip mc to gotoAndPlay the 1photo1 mc?
please help!
i would attach the file but it's too big.
Photo Slideshow With XML - Image Gap On First Cylce Through Slideshow
Hello,
I am new to this site, and I went through the tutorial on this site, "Photo slideshow using XMl and Flash, " http://www.kirupa.com/developer/mx20..._slideshow.htm
but I encountered a problem where my images lag the first time they cycle through all the images in the XML file.
The first time the flash page loads and starts the slideshow, I don't want the gap between the transitioning of the images where the movie backgound shows. I think it has something to do with the images loading for the first time, so I tried to load each picture in a different movieclip with an alpha of 0 before the slideshows starts, but it didn't work and there is still the gap between the images the first time the pictures cycle through the slide show.
Please offer any advice on how to stop the image lag the first time the slideshow cycle through all the images in the XML file.
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers,
Sarge
Control A Nested MovieClip From A Button Component Inside A Seperate MovieClip.
I am a beginner in using Flash and Action Scripting.
This is the Scenerio:
I want to control a movieclip that is inside of another movie clip.
I control it from a button component that is inside of a seperate movie clip.
test = button component instance name
test1 = function
test2 = Movieclip instance name
test3 = Movieclip instance name
testbutton = movieclip name where button component is located
I am able to control a movieclip on the main timeline with the following AS 3.0:
test.addEventListener (MouseEvent.CLICK, test1);
function test1(event:MouseEvent):void
{
event.target.root.test2.gotoAndPlay(2);
}
I want to control a movieclip inside MovieClip1.
I tried this:
test.addEventListener (MouseEvent.CLICK, test1);
function test1(event:MouseEvent):void
{
event.target.root.test2.test3.gotoAndPlay(2);
}
The movie loaded fine when I tested but got this error when I pressed the button:
TypeError: Error #1010: A term is undefined and has no properties.
at Untitled_fla::testbutton_26/test1().
Please help!!!!!!!!!
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,
I created a simpe function:
MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";
formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";
// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);
}
when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);
it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.
does somebody know why this may be?
Cheers
DDT
#1009 Error Movieclip Inside Movieclip Changing The Alpha Property
Problem:
I'm getting this "TypeError: Error #1009: Cannot access a property or method of a null object reference."
What's happening in the flash file is that I've got a movieclip inside a movieclip and when you roll over one of the movieclips the alpha setting for the movieclip inside the initial movieclip is set to 1, then it transitions out back to 0 over a period of time.
var myTween:Tween = new Tween(event.target.parent.ripple_mc, "alpha", Strong.easeOut, 0, 100, 24, false);
It seems to be random but eventually after rolling over the several movieclips on the stage the error comes up. Sometimes the alpha setting stops working and will continue to be visible even though it should have stopped and be invisible after 24 frames.
Would love some help on this.
Cheers,
User Input Creates MovieClip Made Of MovieClip Symbols
Hello. I need some help either with my situation or with the search terms I'm using to try to find an answer.
I am using Flash MX Pro 2004.
I have drawn letters A-Z in Flash in two different styles (for example one that is furry and another that looks like metal). I would like users to select a text style (furry or metal) and enter text via text input field. When they have pressed an Enter button I would like the word to appear made up of the drawn symbols that I created.
I don't want to make an actual font. Any ideas on search terms to find the sort of thing I am looking for? Here's some that I've tried already:
convert text to symbols -- I get tons of results talking about putting textfields in symbols.
user input to symbols -- almost same results as above
custom fonts using symbols -- I get results talking about how to embed fonts and making text bold, italic, etc. Also not what I'm after.
All help is appreciated. Thanks in advance.
Scott
Receive Full Path To A MovieClip, Return A MovieClip Reference.
Hi, I got this function...
Code:
Function getMCPath(path:String)
{
var MC:MovieClip;
MC = eval(path)
return MC;
}
If I send "_level0" this will return _level0, but if I send "_level0.myMC" this will return undefined.
what should I do in order to get full path to _level0.myMC
Thanks in Advance,
DMZ
How To Hide My Current Movieclip And Display 2nd Dynamically Created Movieclip?
I have a movieclip in which there is an image create this movieclip dynamically by reading the oath of the image from file and play an effect. its working fine, now i want to hide this MC after its effect is ended and then dynamically want to create the other MC and similarly so on. how to do that. my code is as below:
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
lv.load("data.txt");
var my_lv:LoadVars = new LoadVars();
my_lv.load("data.txt");
my_lv.onLoad = function(success)
{
if (success)
{
if(this.pic1!=undefined)
{
var ImgMc:MovieClip = createEmptyMovieClip("ImgMc", getNextHighestDepth());
_root.mcLoader.loadClip(this.pic1,_root.ImgMc);
//Some effect on ImgMc
//how to hide the ImgMc whe nits effect is played and then load another image in a movieclip and so on
}
}
}
Movieclip Rollover Effect Disables Internal Movieclip Buttons
Is it possible to have a movieclip rollover effect with another movieclip inside of it that is able to be clicked and do what it's scripted to do?
Let me try to get specific...
Movieclip 1 -- Has www.kirupa.com/developer/mx2004/button_effect.htm applied
Inside of Movieclip 1 --> Buttons that appear visible when you rollover the menu (it comes out of eases into view)
These buttons inside are not being allowed to be pushed because from what I can gather, the complex rollover is not allowing anything to be activated except the rollover effect.
So here's a diagram:
Rollover Movieclip 1 --> Eases it's bottom part up revealing 4 buttons --> These buttons when clicked are supposed to do an action --> Buttons cannot be activated for some unknown reason.
Can anyone help me out? I'm out of ideas after working on this for the past hour or so. If you need any extra info or materials, let me know; I'm sitting right here working on this problem haha.
-Indecisive
Problem With OnRelease For MovieClip Inside Draggable MovieClip [Flash Pro 8]
I have a movie clip, circle_mc, and in it is embed another movie clip, point_mc. I made the circle draggable with this:
Code:
circle_mc.onPress = function() {
startDrag(this);
};
circle_mc.onRelease = function() {
stopDrag();
};
and that part works fine.
I also want to be able to click on point_mc which is within the circle_mc movie clip. So, I added this:
Code:
circle_mc.point_mc.onRelease = function() {
trace("click was successful");
}
This does not work, and I'm pretty sure it is BECAUSE its parent clip is draggable and therefore has its own onRelease function. (If I comment-out the drag code, then the other code works as intended.)
Is there any way to do this or am I out of luck?
How To Load Image Into Movieclip Inside Movieclip That Is Dynamically Created?
Hello Kirupa Cats!
I am building a menu from an XML file, and I'm cool with cyclying thru the xml data to create menu items.
For every menu item in my XML file, I'm using attachMovie to insert a movie clip called menuitem from my library into a movieclip called menuholder. This works no problem, my menuholder movieclip is poplulated with as many menuitem movieclips from the library as designated by the xml data.
However, inside the library movieclip called menuitem, I have another movieclip on its stage, called mc_menuImage. I want to load an image into that movieclip, and I'm taking the URL for the image from the XML data.
My problem is I can't seem to figure out how to fully identify the movieclip mc_menuImage to load the image. It may have something to do with the fact that the library movieclip is being loaded dynamically, but the movieclip inside the library movieclip exisits pysically on the stage. I don't know...here's the code I'm working with:
THE CODE:
var xmlMenu:String = "menu.xml";
menuholder = createEmptyMovieClip("menuholder", -1);
var xmlMenuData:XML = new XML();
xmlMenuData.ignoreWhite = true;
xmlMenuData.load( xmlMenu );
xmlMenuData.onLoad = function(loaded) {
if (loaded) {
var mImage:Array = new Array();
var mRootNode = this.firstChild.childNodes;
totalMenuItems = mRootNode.length;
// fill array
for (var i = 0; i<totalMenuItems; i++) {
mImage.push(mRootNode[i].attributes.menuImage);
}
}
//make the menu
for (var i = 0; i<totalMenuItems; i++) {
var menuitem = menuholder.attachMovie("menuitem", "menu"+i, i);
menuitem.id = i;
/* now here I thought I could just do this: */
menuitem.mc_menuImage.loadMovie(mImage[i]);
/* but that doesn't work... */
};
When I trace menuitem I get this: _level0.menuholder.menu0, _level0.menuholder.menu1, etc, so I figured the syntax menuitem.mc_menuImage would identify the movieclip inside menuitem, but to no avail. Maybe it has something to do with levels, I'm not sure...
So I don't know, any suggestions? Thanks so much!!!
Wait Till Movieclip Gets To Particular Frame Then Play Another Section Of Movieclip
Hi,
I'm trying to reconstruct http://www.kswissfreerunning.com/AU/ with movies of my own.
Basically I have an array that contains the letters the user enters and I have the movie in a separate moviecilps with labels representing the letters.
I have a (what I think) logical set of code here to run through each letter in the user enters:
Code:
for(var k=0; k < letterArray.length; k++){
movie_mc.gotoAndPlay(letterArray[k]);
}
The problem is that it will only play the last letter the user enters. How am I able to make my flash wait till it gets to the end of a section of the movieclip, then play the next one, without it rushing to go straight to the last letter.
My pseudocode looks like this:
For the length of the array
play the next letter
when that letter movie gets to the end
play the next letter
Thanks in advance.
Loading A Movieclip On The Main Stage From A Button Within A Movieclip - Big Headache
Hi there,
i am trying to put together a portfolio site, which uses a 'floating' panel with buttons on it. In order for it to move around it has to be a movieclip. So all the buttons are stored within a single movieclip, which is giving me a headache because i want those buttons to load other movieclips from my library onto the main stage (as like a popup window within the flash)
Its all slightly confusing. i have tried using this code based within the movieclip where my button is based:
button_play.buttonMode = true;
button_play.addEventListener(MouseEvent.CLICK, OpenBox);
function OpenBox (e:MouseEvent):void{
this.addChild(new mc_box());
}
button play is within a movieclip called mcTweenMe2 (which is on the main timeline) and i want the movieclip to be loaded on the main timeline (not within in the movieclip where the button 'button_play' is based) mc_box is the movieclip i wish to load on the main timeline (in the centre) with the ability to close it also!
Bit of a headache, please help me someone i have run out of sites to look for answers!
PS: does anyone know why stop (); wont stop my timeline playing like it used to in AS2? beacause another option for making my site work is making this button target labeled frames in the main timeline, however stop (); don't seem to work now!
Thanks!
Control/sinc Video Movieclip And Text Movieclip
Here´s a tricky one:
I need to sincronize/control a movieclip with texts and a swf (a video) that I loaded, both on the main timeline.
I have a swf (a video) that I loaded in a movieclip into my flash file and a movieclip with texts in it. Both are on the main timeline. Trouble is if the movie is playing and I want to pause it, for example, the swf video pauses but the texts movieclip keeps on playing. If I rewind it, the swf video goes back, the text movieclip still keeps on going. You get the picture.
For control I´m using a camtasia component - camtasia is the software I made the video with. I´m not putting the movie straight into the flash file because the swf made with camtasia turns to be way smaller that if I just loaded into flash.
I´ve attached a txt file with the controller script. Also i´ve put for download the flash file i´m talking about (flashsinc.zip) so you can better understand what I mean. Here´s the adress:
http://www.altoqi.com.br/temp/flashsinc.zip
Thanks a lot.
Trapping Mouse Events For A Movieclip Inside A Movieclip
Hi
Im having a few problems with my events for some movieclips. What I have is an AS2 class which creates a blank movieclip as a holder for submenu movieclips. This blank movieclip must trap its onRollOut event so that it can fade out the menus. The submenu movieclips which are then attached to the holder clip must trap their own mouse events which are defined in another AS2 class. The only trouble is they are not trapped.
I have seen a couple of other posts on the subject but got no clues from them. I was just wondering if what Im trying to do is possible or if Im fighting a loosing battle.
Any help would be much appreciated.
Thanks in advance
Dan
Mouse Event Triggers For Movieclip Inside Movieclip (can It Be Done?)
'canvas' is a large movieclip I am using to put other movieclips 'in' so I can move around and zoom everything at once. Like a coffee table with pictures on it.
I am loading up two images below with variables named map01 and map02. They overlap.
Code:
var map01:MovieClip = canvas.createEmptyMovieClip("map01", canvas.getNextHighestDepth());
map01.loadMovie("http://imagelocation1.jpg");
map01._x=-1000;
map01._y=39;
var map02:MovieClip = canvas.createEmptyMovieClip("map02", canvas.getNextHighestDepth());
map02.loadMovie("http://imagelocation2.jpg");
map02._x=-1000;
map02._y=130;
map01.onRelease = function () {
this.swapDepths(map02);
}
I would like to be able to click one of the images inside canvas and have it jump to the top. In this case, just a simple swap with map02 would be fine, I can manage the depths.
I have put a breakpoint right on the swapdepths line and debugged, and the function never gets called. Probably because it is the onrelease is for 'canvas', not any of the sibling movieclips that flash is looking for.
'canvas' has an onRelease that triggers a stopdrag and a onpress that triggers a startdrag. Removing these two triggers still does not allow any triggers for map01 or map02 to trigger though.
Any suggestions?
Is there some way to setup some logic on a canvas.onRelease function that can easily check to see if the clicked region is on an movieclip inside the canvas?
[F8] MovieClip._currentframelabel Would Be Nice Or, MovieClip.gotoAndStop(_nextlabel)
Ok, so, to my knowledge, up to AS 2.0, there is still no way to return the value of a frame label, correct? Or better yet, why haven't "they" added a "_nextFrameLabel();" or "_prevFrameLabel();" method!?!? Flash has the ability to move the playhead 1 frame at a time just by using the _nextFrame(); and the _prevFrame(); soooooooooo why can't it have the same function, just with frame labels!!!?! e.g. I have a Forward button that would have:
Code:
on(release){
_nextFrameLabel();
}
This would take me to the next frame which has a label, regardless of what it's called... the label could be "c", or "gibblets", or "blahblahblah"...
Or, if there was a property similar to MovieClip._currentframe, which, instead of returning an integer, it would return a string value if the playhead is on a labeled frame! e.g. MovieClip._currentframelabel would return "gibblets" instead of 145.
Basically, if I have a long linear animation with a bunch of manual stops and pauses put into the timeline, I want to avoid having to put a new keyframe in for the "Step Forward" and "Step Backward" buttons every time the playhead reaches a new stop/frame label. Has anyone figured an easier way to do this?
Example:
I have a timeline with 4 labeled frames, A, B, C, D... frame 1 is labeled "A", frame 50 is labeled "B", etc.
I have a layer with a Back and a Next button. So, on frame 50 (labeled "B"), the code for those buttons would be:
Code:
// Back Button
on(release){
gotoAndStop("A");
}
// Forward Button
on(release){
gotoAndStop("C");
}
In order to change that code (e.g. when the playhead gets to the "C" frame) I need to add a keyframe on the button layer... which is fine for this example where I only have 4 sections to deal with... but it's a pain when I have frames "A" through "W" or much more.
Is there a way to dynamically know what the next frame label is with ActionScript without implicitly definining it, thereby removing the necessity for numerous keyframes/code changes for the Back and Next Buttons???
i.e. instead of gotoAndStop("C")... I want gotoAndStop(_nextFrameLabel);
[CS3] Referencing A Movieclip Inside A Movieclip From A Class File
Hello All,
I'm trying to access a movieclip inside another movie clip from a class file that is not attached to either movieclip. For instance, I'm checking hitTests for the avatar the player uses on the game, there are two enemy movieclips. Inside each enemy movieclip is another movie clip that serves as a bounding box (specifically around the mouth of the enemy so it can eat the player). Here is what I have so far that isnt working:
Code:
if (_root['otter']['obbox'].hitTest(this) && touch == false) {
trace("Otter touched Urchin");
gotoAndPlay("hit");
_root['otter'].gotoAndPlay("eat");
touch = true;
}
The class file is for the avatar. On the stage is the otter mc and inside the otter mc is another mc called obbox which is what I'm trying to hitTest against. Needless to say, it doesn't hitTest or trace or play the animation. Is there a way to reference a nested mc? Thanks in advance.
Terror.
Determining The Name Of A Dynamically Loaded Movieclip From A Child Movieclip
I had posted earlier on this topic, but I don't think I was clear enough in my title, or description.
Here's a more detailed explaination of what I I'm trying to do:
I have a .swf file that dynamically generates container movieclips (giving them dynamically generated instance names) and then dynamically loads external .swf files into it.
In my main time line I have a series of objects.
I would like to be able to, from the loaded .swf files, make a call to the objects in the _root timeline (which I can do without a problem) letting these objects know, the name of it's dynamically generated container movieclip that contains my loaded .swf.
1. Parent SWF:
|
2. Dynamically Generated MovieClip Instance:
|
3. Dynamically loaded external SWF File:
. Script needs to know the name of the instance
of #2.
In 3. I tried using the _parent and _parent._parent to get a reference to #2. but all I was able to get was "_level0".
I've also tried using _lockroot (which somone else kindly suggested) to no avail.
Any help is greatly appreciated
Attaching A Movieclip At A Specific Location Inside Another Movieclip
Hello all,
I am trying to attach a movieclip(a) inside another movieclip(b). When (a) is attached it is always attached at the top left corner OR if I use getNextHighestDepth() then the movieclip (a) is attached randomly at different locations. I would like (a) to be attached at the centre of the parent movieclip or at a specific location inside parent movieclip.
Please help me with this. Me a newbie to actionscripting.
Thanks,
Nish
Child Movieclip Staying Within Boundries Of Parent Movieclip
I am trying to create a child movieclip that should only be displayed within the boundaries of the parent movieclip.
Lets say I have a stage of 800x600 pixels. The parent movieclip is 600x400 pixels. When I create a child-movieclip and place it at _x = 650, the movieclip "disapears" as it is outside the boundaries of the parent movieclip.
I'm pretty sure I am doing something wrong in the creation of the child movieclip, but can anyone help me PLEASE!?!
- mortenft
Dynamic Movieclip Resizing With A Textfield Inside Of The Movieclip
Hello,
I've searched past posts in regards to resizing textfields but I was unable to find any help with the problem I am having resizing a movieclip that contains a textfield.
Basically I am dynamically creating an emptyMovieClip, then within that empty movieClip I am then creating a text fielld and populating it with text.
When I try to resize the movieclips instance by clicking on a button and changing the ._width of the movieclip and it fails.
Please help,
frank grimes
Unable To Select Previous Movieclip After Duplicate Movieclip
i have a movieClip and was able to duplicate the movieClip. But now the problem is, after i have duplicated the movieClip i cannot select the previous movieclip which don allow me to move it around. Is there anyway that will allow me to select my previous movieclip after duplicated?
Below is my code:
Attach Code
var mySelection = "";
wire.onPress = function ()
{
this.createEmptyMovieClip("mc1", 90);
duplicate(mc1);
mc1 = attachMovie("idwire", "wire1", 91);
mc1._x = 273;
mc1._y = 196.5;
dragging(mc1);
}
function dragging(mc)
{
mc.onPress = function()
{
this.startDrag(true);
mySelection = this;
}
mc.onRelease = mc.onReleaseOutside = function()
{
stopDrag();
}
}
function duplicate(mc)
{
amount = 50;
while(amount>0)
{
mc.duplicateMovieClip ("mc"+i, i);
i++;
amount--;
}
}
SetProperty Doesn't Work With Movieclip Inside Of Movieclip
I originally had this set up this way and it worked.
var hita:Boolean = false;
logotop.onEnterFrame = function() {
hita = this.hitTest(this._parent.middle.hitme);
if (hita == true) {
setProperty ("logotop", _alpha, "0");
}
}
Then I put everything in a new movieclip with the instance name "printme".
Now it doesn't work and doesn't give me an error.
var hita:Boolean = false;
printme.logotop.onEnterFrame = function() {
hita = this.hitTest(this._parent.printme.middle.hitme);
if (hita == true) {
setProperty ("printme.logotop", _alpha, "0");
}
}
Do you see anything wrong with the above code?
How To Swap Movieclip With Other Content, In A Movieclip Loaded External
Hi! I'm getting desperated.
I started about 3 days ago trying to solve this problem, maybe i'm very noob!
I have a main movie. Inside this, i load various externals swf's. One swf for a menu, another for a image presentation, etc.
In the menu, i load various instances of another swf file... a button swf, and witch one has to have a different image as button.
So inside the button, i have a layer with a button, but no shape or nothing, and in another layer, i have a movieclip to can swap by an image.
So, the struct is like this:
Main Movie
. image_presentation
. contact
. menu
. . button1
. . . button
. . . image
. . button2
. . . button
. . . image
. . button3
. . . button
. . . image
. . button4
. . . button
. . . image
So, button is only a swf file, with various instances. "button" inside the buttons, make the button efect, with a white border apearing on mouse over button. "image" is a movieclip created only for change with an image (button 1 = image 1, button 2 = image 2, etc).
How can i do this, controlling the images url's from the main movie?? I had tried a lot of ways, but i could do it.
Please help.
Thanks.
Duplicated Movieclip Doesn't Inherit Loaded Movieclip
I'm loading an image into a blank_mc within a movieclip called 'background_mc' using the MovieClipLoader object; when the onLoadInit for the MovieClipLoader object is fired, i then attempt to clone my 'backgound_mc' object and the loaded image it contains so i can do something with it (i,e a funky masky/blur thing, not important right now)
I'm successfully loading my image into the blank clip within background_mc, the onLoadInit behaviour fires and duplicates background_mc once the image has been loaded, but in a disappointing turn of events, my clone of background_mc no longer has an image attached, and has instead reverted back to it's original form, just as ti was before it had the jpeg image loaded in.
Has anyone ever encountered something like this this before regarding the duplicateMovieClip command, and if so can anyone suggest a workaround?
*goes off to boost karma by helping others*
Thanks!
Chris
Exending Movieclip Class With Your Own Movieclip And How To Create Children In It.
I was writing actionscript for a custom movieclip class I made.
Created my movieclip in flash and linked it as Dude class.
One question: Is it possible to override the constructor? I tried to do it but flash gives me an error "duplicate function definition"
Another question: How do I create a displayobject in this movieclip? I tried to do something like this inside the actionscript for the Dude movieclip.
Code:
var mytext:TextField = new TextField();
// code to change textfield's properties
addChild( mytext );
But when I created an instance of Dude on the stage the textfield isn't showing.
|