In actionscript 3.0 how do i make a nested movie clip button go to a frame on the main timeline
I am making a website based in flash actionscript 3.0 i have a button nested in its own movie clip, because I have the button expanding to be able to read it i have figured out the only way to do this is by creating it as a movie clipa nd inside the movie clip creating it as a button
I added an event listener to the blog button by saying,
blog.addEventListener(MouseEvent.ROLL_OVER,gotoblog);
function gotoblog(evtobj:MouseEvent){
gotoAndStop(2)
this part of the code works it goes to the 2nd frame of the timeline it is in and stops wich is a blown up version of the origanal symbol
i added on frame 2 a second command
blog.addEventListener(MouseEvent.CLICK.gotoblogpage);
function gotoblogpage(evtobj:MouseEvent){
gotoAndStop("blogframe")
trace("the blog button was clicked")
i have named the symbol blog and have name the frame of where the blog page is going to be "blogframe" this line of code at the bottom is where i run into trouble the output window in Flash is saying "The blog button was clicked" just like i want it to. no errors are accouring why than is the playhead not going to frame "blogframe"? if the button is working when i click it the code is right i belive the problem here is it does not want the playhead to go to the frame i want it to. So i gues my question is, how can i make a button withing a movie clip interact with the main timeline?
I have a similar problem if could please help me i'd really apreciate it!!
So i have a looping animation of some thumbnails, the hierarchy goes like this
Scene1(main timeline) -> imgBar(MC)->imgBarB(MC within the imgBar MC)
My buttons symbols are in the last MC "imgBarB" where i have this code:
ss1.addEventListener(MouseEvent.CLICK, OneButtonClicked);
function OneButtonClicked(event:MouseEvent):void{
MovieClip(root).gotoAndStop("ssbox1");
I want to control the Btns in my "imgBarB" MC to play a labeled frame(named "ssbox1") on another MC on the main timeline,this other MC goes like this:
Scene1(main timeline)->ssbox_mc(MC where my labeled frame is)
Similar Messages
-
Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?
code on the last frame of your movieclip instance:
_root.gotoAndStop('whatever_frame'); // will work unless this swf is loaded into another swf. in that situation, you should use a relative path to the main timeline (eg, _parent or _parent._parent etc). -
How do I target a nested Movie Clip in an FLV component?
Hello all!
I have a video player that's control bar's x & y are over
the top of the video. It is set to alpha 0, and when the user rolls
over the video the control bar's alpha goes to 1 and becomes
visible. I have a few even listeners and a function that makes this
happen.
My issue is that the buffer handle and the volume handle do
not go to alpha 0, despite the fact that their parents do. The
instance of "volumeHandle" is the child of "volumeSlider".
"volumeSlider" does go to alpha 0, then to alpha 1 on rollover, but
it's child "volumeHandle, is always visible. The same applies to
the respective instances of the buffer bar.
I have tried volumeHandle.volumeSlider.alpha = 0; ,but that
doesn't work.
My guess is that the conflict lies in the linkage of the
controls for the buffer and volume handles.
Any guidance would be greatly appreciated! Thanks in advance.
ShawnAlso, the AS I have for the volume bar movie clip, instance
name "volumeSlider" is:
stop();
this.handleLinkageID = "VolumeBarHandle";
this.handleLeftMargin = 3;
this.handleRightMargin = 3;
this.handleY = 11;
this.fullness_mc.fill_mc.slideReveal = true;
The VolumeBarHandle linkageID applies to the same MC as the
"volumeHandle" instance.
This is one of the two movie clips that will not go to alpha
0.
Thanks again. -
I am creating an automotive braking system using flash and have a wheel turning. I want the wheel to slow down and stop after the brake pedal is pushed at a certain frame. I know I could do this with frame by frame animation but was hoping there was a short cut - javascript?? If not the slowing down portion then is there code for just making the internal movie clip (wheel turning) to stop when it gets to a frame.? Thanks
you can use the ticker class to create a loop that you use to control the wheel's rotation or frame, TweenJS v0.6.0 API Documentation : Ticker
-
How do I View Guides for Movie Clips in Relation to Entire Scene?
My boss purchased a flash animation from a company a few months ago that she now needs me to fix. The goal is to resize the animation to different dimensions for a new banner. I took the original file, brought up the document settings, and changed the size to the new one we need, and hit the "scale content" checkbox. The file I have after doing this is shown below; I have highlighted the shape I will be talking about in pink. Nothing is the correct size now so I am trying to resize them to fit the stage area. I am having trouble with the green shape that is highlighted Pink.
The person who originally made this file made that highlighted shape into a movie clip and then dropped it in to the main timeline. I was wondering if there was a way that I could see where that shape is in relation to the area of the entire stage and the other objects in the main timeline? Meaning if I am inside of the greenblock movie clip all I see is what is below:
With this view I cannot tell where that shape is in relation to everything else. I am hoping someone can tell me how to view the guides from my main file inside of this movie clip( I already have guides turned on), or any other way of seeing what size and where my shape is in relation to rest of the objects on the stage of my main file. I would take any option that would let me tweak the green shape inside of the movie clip and see in real time how it looks in relation to the rest of the items on the stage as I make changes.
Any suggestions on how to get perspective on where my movie clip is in relation to the stage and other objects on it would be greatly appreciated.
Sincerely,
TissalSomehow double clicking on your system seems to be connected to the command
fl.getDocumentDOM().enterEditMode('');//the view where you don`t see the rest of your stage
whereas normally it defaults to
fl.getDocumentDOM().enterEditMode('inPlace'); //the view where you can see everything els on stge alphablended
you can either create a shortcut to
edit>edit in place or alter the standard behaviour of your double click
or right click(Windows) or ctrl-click(MAc) the mc and choose Edit in Place -
How to remove a function on the main timeline within a movie clip
How do you remove a function that is coded on a frame in the main timeline from within a movie clip? I tried this, but no dice:
infoGraphicDisparity.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);
function fl_ClickToGoToScene(event:MouseEvent):void
parent.removeEventListener (Event.ENTER_FRAME, parent["enterFrameHandler"]);
MovieClip(this.root).gotoAndPlay("disparity");
this is the event I am trying to remove:
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
any help would be appreciated as always.
Thanks!from any frame (that executes after enterFrameHandler is defined) in any display object in the display list
stage.removeEventListener(Event.ENTER_FRAME, MovieClip(root).enterFrameHandler); -
How can i make a transition between clips on cutaway?
how can i make a transition between clips on cutaway?
ninafromlisboa wrote:
But if I want ONLY fade out (or in) I can't do it...
OK, I understand what you mean now! I assumed you were asking about the normal Fade In or Fade Out using the transition from the Transitions panel. But I guess you mean the Fade function specific to a Cutaway. When you double-click on a Cutaway the Inspector opens. Here you can set the Cutaway Fade duration. But as you say, it only provides for both fade in and fade out as one operation - you can't set the fades individually (it's both or nothing).
BUT, try the method outlined by Karsten Schluter above. It will give you the same effect and will enable you to fade either side of the Cutaway (or add other transitions).
John -
How do I make a simple swf made up of a series of pictures the user advances by clicking?
I'm shwoing a step by step process on how I did a photoshop piece, and I want to have a simple flash swf that goes through each of the screenshots at the viewer's pace, by them clicking. I wasn't even thinking so complicated as to include forward/back buttons, even just somethign so simple as having the entire image clickable to move 'forward' and when it gets to the end it just loops or something. super simple, i would do an animaged gif but i want it to be at the user's own pace. but if you think of how an animated gif cycles that's how simple i want it to be. also a few of fading/dissolivng between the images would be cool.
Could anyone who knows flash give me some pointers?If you want simple, just place the images sequentially, one each per frame, along the timeline. Then add an actions layer and place a stop(); command in the first frame of that layer. Then add a button to the stage and code it to use nextFrame(); How you code it depends on which version of actionscript you are planning to use, but nextFrame works for either. What nextFrame does is advances you to the next frame and stops, so you only need the one stop() on the timeline to have the movie stopped when it loads.
The more features you want to add, the more complicated it gets, so for the moment I'll leave you with the most simplified approach above.
If you want to have transitions between images, then you need to deal with adding timeline tweens that fade them in/out as desired. Although, what you could do instead is have a movieclip on a layer above the images that fades in and out on command. The contents of it would simply be a rectangle graphic symbol that is the same color as the stage, but has its alpha value at 0 in the first frame (with a stop()), and then fades in and out again. So the button controls the playing of that movieclip, and when that movieclip reaches the point where the rectangle is in full view, that movieclip commands the main timeline to advance to the nextFrame() -
How can I make a global change so all controls and indicators labels on the front panel change to another colour?
I need to change the front panel so that it can be used in a dark environment.Hi
The only way I see, is to use the "Controls[]" property and iterate through all of them. But don't forget about nested elements (i.e. clusters, tab-controls, ...).
Thomas
Using LV8.0
Don't be afraid to rate a good answer... -
In elements 11 how do I make a finished movie return to the start menu?
In Elements 11 how do I make a finished movie return to the start menu?
Maud23
I just got through a run through of your issue using Premiere Elements 8.0/8.0.1 and Premiere Elements 11 on Windows 7 64 bit and my TV DVD player.
Whether it was Premiere Elements 8.0/8.0.1 or Premiere Elements 11 with or without menu markers on the project's Timeline, the DVD-VIDEO on DVD disc produced played back the same on my TV DVD Player.
Results...
No disc menus and with or without scene markers on the Timeline
Timeline - color matte - jpg 1, jpg 2, jpg3, jpg 4, jp5
Hitting Play, played back was from the color matte to the jp5 and then back to the DVD player logo, not the color matte.
If I applied a disc menu (just main menu page, no scene markers on the Timeline)
Timeline - color matte - jpg1, jpg2, jpg3, jpg4, jp5
The main menu would automatically appear. When I hit Play (only option since no scene markers/no Scene Selection button on the main menu), the playback would start at the color matte, continue to jpg5, and then return to the main menu page, not the DVD player logo nor the color matte.
Again, it did not matter if the DVD-VIDEO described above was created in version 8.0/8.0.1 or 11, same results.
I did not explore fully TV DVD settings to determine if answers could be found on the TV DVD player side of things. I have not found them.
Could you elaborate on what you wrote
At the start I chose to use a single slide from the Elements 11 menu selection.
Are you saying that whatever you did there was consistent with you getting what you wanted when you did that but used version 8.0/8.0.1 instead of 11? From what you wrote, I am wondering if what you did was to apply just the main menu of a disc menu to the project to get what you wanted just like I did in my road testing of the issue tonight.
We will be watching for further details.
Thank you.
ATR -
How can I reference the main timeline on a swf once it was loaded into another?
I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.This is basically what I´m doing here:
I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
// This is a variable I created for tracking the timeline
var base:MovieClip = MovieClip(root);
function textAnimate(movieName:String, espera:Number):void {
//var espera:Number = 1; //Waiting time
var objeto:MovieClip = base[movieName]; //Variable to select the object
var posFinal:Number = objeto.x; // Object position
var posEnter:String = "-160"; // Animation start (relative)
var posExit:String = "+160"; // Animation end (relative)
// enter animation
TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
//call exitAnimation() after X seconds
TweenMax.delayedCall(espera,exitAnimation);
//exit animation
function exitAnimation() {
TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/ -
How do I recerence Movie Clips on the Main Timeline from inside a class?
Hey everyone, this might be a stupid question but I thought
I'd ask cause it's making me nuts. I'm all of 2 days into AS3
(coming from not using Flash at all in YEARS) so feel free to
consider me ignorant. I do have plenty of application development
experience in other areas though.
I can't seem to create a class that can reference an instance
of a movie clip on my main timeline. I'd post code of what I've
tried but I've gone through so many desperate edits & wild
guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe
it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true
object oriented environment, I wouldn't need to mix my code and
interface together. Preferably I'd be using the Flash authoring
tools just to design my interface. Create a button... place it
somewhere... give it an instance name. Roughly the equivilant of
Apple's InterfaceBuilder for those of you that might be familiar
with Cocoa development. I can see maybe having to put a few lines
of ActionScript onto frame 1 (though really I'm hoping Flash would
have a better method of kicking off the application at this point
that using code tied to frames) to load my classes & such, but
after that I'd like all of my code to be held in external class
files.
So maybe I've got:
Interface.fla - My interface
Button_1
Button_2
TextField_1
Main.as - My main controller class using to handle all of my
applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method
to go ahead & attach events to buttons & initialize
anything else that needs to happen when the application starts.
From there on it would all be objects communicating back &
forth. Button_1 would get clicked with would fire
Main.someMethod(). Main.someMethod() would then do it's thing and
set the value of TextField_1. All very clean & code is very
separated from interface.
Unfortunately I can't for the life of me figure out how AS3
classes reference each other like that. There doesn't seem to be
any kind of a global 'root' or '_root' I can use to locate any
movie clips on the stage. I've searched the help & the web for
any kind of simple tutorial but to no avail. My job has tasked me
with building a flash app for a project but I'd really rather not
have a tone of ActionScript just shoved into frame 1. That just
seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm
really willing to do my homework but I can't seem to locate the
info I need to get started. Also, is there an ActionScript IRC
channel or something maybe?
Thanks,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
How do I set a variable on the main timeline from within a symbol?
Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
Relatedly, how do you access a function on the main timeline from within a symbol?
Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.Hi Bill,
There are plenty of threads on here about scope, but here's one way to create a global variable:
// code on Stage.compositionReady
sym.myGlobalVar = 1;
Then, anywhere in your project, you can check/set that var like so:
sym.getComposition().getStage().myGlobalVar = 2;
And here's one way to create a global function:
// code on Stage.compositionReady
sym.myGlobalFunction = function(){
console.log('myGlobalFunction');
Then, anywhere in your project, you can call that function like so:
sym.getComposition().getStage().myGlobalFunction(); -
How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?
on this link http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
I found this script, but I can not use it can anyone help me
// create a variable to reference swf1's main timeline
var swf1Main_mc:MovieClip; // this assumes that swf1 is a movieclip.
// create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
// reference to its main timeline (which is always the main timeline of the loading swf).
this.addEventListener(Event.ADDED_TO_STAGE, initF);
function initF(e:Event):void{
swf1Main_mc = MovieClip(this.root);You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
var loader:Loader = new loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
//rest of your loader loading code here
protected function onLoaderLoaded(e:Event):void {
//add to display list (you already know how to do, so I'm not writing the code)
EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
//if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
//this is what you actually need to care about to do this correctly
customSwf = LoaderInfo(e.target).content as CustomSwf;
Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
protected function fEvent(e:Event):void {
dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
back in your main document Class:
//should probably call from the constructor or somewhere early in the process
protected function init():void {
//use your real event name--your code isn't expressive enough I could guess a good name
addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
protected function onEventHappened(e:Event):void {
customSwf.customFunctioninSwf1();
customSwf.changeVisualState();//let custom swf change alpha and change the frame #
To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day). -
How to play the main timeline after a movie clip is finished playing.
Ok so here is the problem, I have the main time line with three layers: My actions layer, a music layer, and the movie clip layer.
The movie clip is an actionscript movie which calls images from an external XML file and shows them as a slideshow. What i need to do is after the last image plays, stop the movie and move the main timeline to the next scene of the main movie. Everything logical in my brain is not working, and it may be that I have been staring at this project for too long but for the life of me i can't make this work.
Any help or input would be greatly appreciated!
Thanks in advance.
Meghanbetter yet, here is the whole code. With your suggestion entered...
import flash.display.BitmapData;
import gs.*;
import gs.easing.*;
import gs.plugins.*;
TweenPlugin.activate([BlurFilterPlugin]);
OverwriteManager.init();
var xml:XML = new XML();
xml.ignoreWhite = true;
_root.xmlPath == undefined ? xml.load("jake.xml") : xml.load(_root.xmlPath);
//when xml is loaded
xml.onLoad = function(succes:Boolean) {
if (succes) {
//position the slideshow. remember size.
__width = Number(xml.firstChild.attributes.width);
__height = Number(xml.firstChild.attributes.height);
mcMask._width = mcBlack._width=mcHyper._width=__width;
mcMask._height = mcBlack._height=mcHyper._height=__height;
//preloader
mcPreloader._x = __width/2;
mcPreloader._y = __height/2;
(new Color(mcPreloader).setRGB(Number(xml.firstChild.attributes.preloaderColor)));
//buttons
var buttonLoader:MovieClipLoader = new MovieClipLoader();
var buttonListener:Object = new Object();
buttonListener.onLoadInit = function(cButton:MovieClip) {
if (cButton._parent == btnNext) {
cButton._parent._x = __width-cButton._width;
} else if (cButton._parent == btnPrev) {
cButton._parent._x = 0;
} else {
cButton._parent._x = (__width-cButton._width)/2;
cButton._parent._y = (__height-cButton._height)/2;
buttonLoader.addListener(buttonListener);
buttonLoader.loadClip(xml.firstChild.attributes.prevButton,btnPrev.holder);
buttonLoader.loadClip(xml.firstChild.attributes.nextButton,btnNext.holder);
buttonLoader.loadClip(xml.firstChild.attributes.playButton,btnPlay.holder);
buttonLoader.loadClip(xml.firstChild.attributes.pauseButton,btnPause.holder);
xml.firstChild.attributes.slideshowOn == "true" ? [_slideshow=true, btnPlay._visible=false] : [_slideshow=false, btnPause._visible=false];
for (var i:Number = 0; i<xml.firstChild.childNodes.length; i++) {
//create empty movieclip for each picture. create mask movieclip for each picture. save transition and ken burns settings for each picture. save other properties for each picture.
mcTemp.createEmptyMovieClip("mcPhoto"+i,mcTemp.getNextHighestDepth());
mcHolder.createEmptyMovieClip("mcPhoto"+i,mcHolder.getNextHighestDepth());
mcHolder["mcPhoto"+i].createEmptyMovieClip("photo",mcHolder["mcPhoto"+i].getNextHighestDe pth());
//attach text clip and set it up
mcHolder.attachMovie("square2","mcBack",mcHolder.getNextHighestDepth());
mcText.attachMovie("text","text"+i,mcText.getNextHighestDepth());
mcText["text"+i].mcText._alpha = mcBack._alpha=0;
mcBack._width = mcText["text"+i].mcText._width=__width;
mcText["text"+i].mcText.autoSize = true;
mcBack._height = 0;
mcBack._y = __height;
(new Color(mcBack).setRGB(Number(xml.firstChild.attributes.textBackColor)));
mcHolder["mcPhoto"+i].transition = Number(xml.firstChild.childNodes[i].attributes.transition);
var burns:Array = String(xml.firstChild.childNodes[i].attributes.kenBurns).split(";");
mcHolder["mcPhoto"+i].burns = burns;
mcHolder["mcPhoto"+i].time = Number(xml.firstChild.childNodes[i].attributes.time);
mcHolder["mcPhoto"+i].src = String(xml.firstChild.childNodes[i].attributes.src);
mcHolder["mcPhoto"+i].txt = String(xml.firstChild.childNodes[i].firstChild.nodeValue);
mcHolder["mcPhoto"+i].url = String(xml.firstChild.childNodes[i].attributes.url);
mcHolder["mcPhoto"+i].target = String(xml.firstChild.childNodes[i].attributes.target);
//handle loading process. create loader objects. start "intelligent loading". set methods and actions for new newly loaded pictures.
var photoLoader:MovieClipLoader = new MovieClipLoader();
var photoListener:Object = new Object();
photoListener.onLoadInit = function(cPhoto:MovieClip) {
//transform image to bitmap
cPhoto._visible = false;
var tempBitmap:BitmapData = new BitmapData(cPhoto._width, cPhoto._height);
tempBitmap.draw(cPhoto);
var cPhoto2:Object = mcHolder["mcPhoto"+_loaded].photo;
cPhoto2.attachBitmap(tempBitmap,1,"auto",true);
photoLoader.unloadClip(cPhoto);
removeMovieClip(cPhoto);
cPhoto2._parent._visible = false;
//remember original size
cPhoto2._parent.width2 = cPhoto2._parent._width;
cPhoto2._parent.height2 = cPhoto2._parent._height;
cPhoto2._alpha = 0;
_loaded++;
cPhoto2._parent.loaded = true;
if (_loaded<xml.firstChild.childNodes.length) {
//load next picture
photoLoader.loadClip(mcHolder["mcPhoto"+_loaded].src,mcTemp["mcPhoto"+_loaded]);
if (_loaded == _index+1) {
//show this picture
showPicture(cPhoto2._parent);
photoLoader.addListener(photoListener);
photoLoader.loadClip(mcHolder.mcPhoto0.src,mcTemp.mcPhoto0);
//function that changes to the next photo(slideshow feature)
function nextPhoto() {
_index++;
if (_index == xml.firstChild.childNodes.length) {
//if picture is loaded, just show it. if not, wait until it loads
if (mcHolder["mcPhoto"+_index].loaded) {
showPicture(mcHolder["mcPhoto"+_index]);
} else {
TweenLite.to(mcPreloader,.5,{_alpha:0});
TweenLite.to(mcBlack,.5,{_alpha:100,onComplete:completeF});
function completeF(){
_root.gotoAndPlay("frame1_scene2");
//function that changes to the previous photo
function prevPhoto() {
_index--;
if (_index == -1) {
_index = xml.firstChild.childNodes.length-1;
//if picture is loaded, just show it. if not, wait until it loads
if (mcHolder["mcPhoto"+_index].loaded) {
showPicture(mcHolder["mcPhoto"+_index]);
} else {
TweenLite.to(mcPreloader,.5,{_alpha:100});
TweenLite.to(mcBlack,.5,{_alpha:80});
//buttons - roll overs
btnNext.onRollOver = btnPrev.onRollOver=btnPause.onRollOver=btnPlay.onRollOver=function () {
TweenLite.to(this,1,{_alpha:70});
btnNext.onRollOut = btnPrev.onRollOut=btnPause.onRollOut=btnPlay.onRollOut=btnNext.onReleaseOutside=btnPrev.o nReleaseOutside=btnPause.onReleaseOutside=btnPlay.onReleaseOutside=function () {
TweenLite.to(this,1,{_alpha:100});
//buttons - next
btnNext.onPress = function() {
if (!_transition) {
clearTimeout(nextT);
nextPhoto();
} else {
clearTimeout(nextT);
nextT = setTimeout(nextPhoto, 500);
//buttons - previous
btnPrev.onPress = function() {
if (!_transition) {
clearTimeout(nextT);
prevPhoto();
} else {
clearTimeout(nextT);
nextT = setTimeout(prevPhoto, 500);
//buttons - play
btnPlay.onPress = function() {
switchVisible(btnPlay);
switchVisible(btnPause);
_slideshow = true;
if (!_transition) {
clearTimeout(nextT);
nextPhoto();
} else {
clearTimeout(nextT);
nextT = setTimeout(nextPhoto, 500);
//buttons - pause
btnPause.onPress = function() {
switchVisible(btnPlay);
switchVisible(btnPause);
_slideshow = false;
clearTimeout(nextT);
//function that animates text(html for each picture)
function inText(cPhoto:Object) {
if (cPhoto.txt != "undefined") {
mcText["text"+_index].mcText.htmlText = cPhoto.txt;
mcText["text"+_index].mcText._y = mcBack._y-mcText["text"+_index].mcText._height-4;
TweenMax.to(mcText["text"+_index].mcText,0,{blurFilter:{blurX:15, blurY:15, quality:1}});
TweenMax.to(mcText["text"+_index].mcText,Number(xml.firstChild.attributes.textSpeed),{blu rFilter:{blurX:0, blurY:0}, _alpha:100});
TweenLite.to(mcBack,Number(xml.firstChild.attributes.textSpeed),{_alpha:Number(xml.firstC hild.attributes.textBackOpacity), _height:mcText["text"+_index].mcText._height+7});
} else {
mcText["text"+_index].mcText.htmlText = "";
TweenLite.to(mcBack,Number(xml.firstChild.attributes.textSpeed),{_alpha:Number(xml.firstC hild.attributes.textBackOpacity), _height:0});
function outText(cPhoto:Object) {
TweenLite.to(mcBack,.5,{_alpha:0});
TweenLite.to(mcText["text"+_index2].mcText,.5,{_alpha:0});
//function that applies the ken burns effect to a specific photo
function kenBurns(cPhoto:Object) {
//reset size and position
cPhoto.photo._xscale = cPhoto.photo._yscale=Number(cPhoto.burns[0]);
cPhoto.photo._x = returnPosition(cPhoto.burns[2], cPhoto.photo._width, cPhoto.photo._height, mcMask._width, mcMask._height).__x;
cPhoto.photo._y = returnPosition(cPhoto.burns[2], cPhoto.photo._width, cPhoto.photo._height, mcMask._width, mcMask._height).__y;
//start effect
TweenLite.to(cPhoto.photo,cPhoto.transition+Number(cPhoto.time)+1,{_xscale:Number(cPhoto. burns[1]), _yscale:Number(cPhoto.burns[1]), _x:returnPosition(cPhoto.burns[3], cPhoto.width2, cPhoto.height2, mcMask._width, mcMask._height).__x, _y:returnPosition(cPhoto.burns[3], cPhoto.width2, cPhoto.height2, mcMask._width, mcMask._height).__y, ease:Linear.easeNone});
//function that shows a picture(transition function)
function showPicture(cPhoto:Object) {
for (var i:Number = 0; i<xml.firstChild.childNodes.length; i++) {
if (i == _index || i == _index2) {
mcHolder["mcPhoto"+i]._visible = true;
}else{
mcHolder["mcPhoto"+i]._visible = false;
cPhoto.swapDepths(mcHolder.getNextHighestDepth());
setTimeout(hideOld,cPhoto.transition*1000,mcHolder["mcPhoto"+_index2]);
//text
outText(mcHolder["mcPhoto"+_index2]);
_index2 = _index;
inText(cPhoto);
kenBurns(cPhoto);
TweenLite.to(mcPreloader,.5,{_alpha:0});
TweenLite.to(mcBlack,.5,{_alpha:0});
//transition variable
_transition = true;
clearTimeout(transT);
transT = setTimeout(switchTransition, cPhoto.transition*1000);
cPhoto.photo._alpha = 0;
TweenLite.to(cPhoto.photo,cPhoto.transition,{_alpha:100});
if (_slideshow) {
//if slideshow is on
nextT = setTimeout(nextPhoto, (cPhoto.transition+cPhoto.time)*1000);
function hideOld(what:Object){
//hyperlinks
mcHyper.useHandCursor = true;
mcHyper.onPress = function() {
if (mcHolder["mcPhoto"+_index].url != "undefined") {
getURL(mcHolder["mcPhoto"+_index].url, mcHolder["mcPhoto"+_index].target);
//function that returns a number position from a given "compass position"(for the ken burns effect)
function returnPosition(pos:String, __width:Number, __height:Number, __width2:Number, __height2:Number):Object {
var returnObj:Object = new Object();
switch (pos) {
case "TL" :
returnObj.__x = 0;
returnObj.__y = 0;
break;
case "TC" :
returnObj.__x = -(__width-__width2)/2;
returnObj.__y = 0;
break;
case "TR" :
returnObj.__x = -(__width-__width2);
returnObj.__y = 0;
break;
case "ML" :
returnObj.__x = 0;
returnObj.__y = -(__height-__height2)/2;
break;
case "MC" :
returnObj.__x = -(__width-__width2)/2;
returnObj.__y = -(__height-__height2)/2;
break;
case "MR" :
returnObj.__x = -(__width-__width2);
returnObj.__y = -(__height-__height2)/2;
break;
case "BL" :
returnObj.__x = 0;
returnObj.__y = -(__height-__height2);
break;
case "BC" :
returnObj.__x = -(__width-__width2)/2;
returnObj.__y = -(__height-__height2);
break;
case "BR" :
returnObj.__x = -(__width-__width2);
returnObj.__y = -(__height-__height2);
break;
return returnObj;
function switchTransition() {
_transition == true ? _transition=false : _transition=true;
function switchVisible(obj:Object) {
obj._visible == true ? obj._visible=false : obj._visible=true;
mcTemp._x = -10000;
//mouse testing
var mouse_dx:Number = _xmouse;
var mouse_dy:Number = _ymouse;
var mouseSpeed:Number = 1;
function checkPosition(Void):Void {
if (_xmouse<mouseSpeed || _xmouse>(Stage.width-mouseSpeed) || _ymouse<mouseSpeed || _ymouse>(Stage.height-mouseSpeed)) {
//mouse outside - hide buttons
TweenLite.to(btnPrev,.5,{_alpha:0});
TweenLite.to(btnNext,.5,{_alpha:0});
TweenLite.to(btnPlay,.5,{_alpha:0});
TweenLite.to(btnPause,.5,{_alpha:0});
} else {
//mouse inside
TweenLite.to(btnPrev,.5,{_alpha:100});
TweenLite.to(btnNext,.5,{_alpha:100});
TweenLite.to(btnPlay,.5,{_alpha:100});
TweenLite.to(btnPause,.5,{_alpha:100});
checkPosition(Void);
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function():Void {
mouse_dx = Math.abs(mouse_dx-_xmouse);
mouse_dy = Math.abs(mouse_dy-_ymouse);
mouseSpeed = mouse_dx>mouse_dy ? mouse_dx : mouse_dy;
mouseSpeed += 1;
checkPosition(Void);
mouse_dx = _xmouse;
mouse_dy = _ymouse;
Mouse.addListener(mouseListener);
//global variables
var this2:Object = this;
var __width:Number;
var __height:Number;
var _index:Number = 0;
var _index2:Number = -1;
var _loaded:Number = 0;
var nextT:Number;
var transT:Number;
var _slideshow:Boolean = true;
var _transition:Boolean = false;
Stage.scaleMode = "noScale";
Stage.showMenu = false;
Stage.align = "TL";
Maybe you are looking for
-
When I delete files from robohelp and from the server where I publish my robohelp files too, they tend to reappear the next time that I publish. So in essence, I am unable to remove any files...Please help...
-
Is it possible to install Windows 98 on Lenovo R61? (Without Virtual PC)
Hi all, Just wondering whether I can install Windows 98 on a standard stock R61 8918-5KM series? I had purchased this notebook quite some time ago, but would like to go back into just having Windows 98 installed natively seeing I have a large collect
-
Impact on Packet delay and Jitter due to IPSec
We are planning to use IPSec between two 7604 routers. And IPSec actually adds more overhead to the packet there will be impact on the traffic. We would like to know the impact on Packet delay and Jitter due to IPsec on 7604 or 7606 routers.
-
AFP dies 2-3 times daily, "I/O error" in console logs
Repair Disk checked out fine... Is it my network?
-
Subscription issue, wrong payment type.
I have a subscription that is stuck in pending. Could it be because I accidentally entered Mastercard as my payment option when it was really a Visa?