Multi-layer movie clip as mask
Hello all,
I want to use as a mask a movie clip that has several layers
with tweens. Somehow this doesn't work for me - all I see when I
set this movie clip as mask is one of these layers - the others
remain invisible. For example, I have two layers - on layer 1, the
object I want to be masked; above it, on layer 2, the mask. This
mask is a MC that has several layers with animated (tweened) ovals
moving in different directions. When I preview the animation, only
one of these ovals is visible. How can I make it work properly?
thanks in advance,
Mikolaj
enable the cacheAsBitmap properties of your masked and
masking movieclips and see if your problem resolves.
Similar Messages
-
I'm trying to use a movie clip as a mask layer. The movie
clip contains both lines and fills. The fill areas are working
perfectly but the lines are appearing all weird and streaked (it's
actually quite cool looking but not what I'm ideally after). The
masked layer is just a block of plain colour fill. Has anyone had
the same problem as me and if so is there a work around? Do lines
and fills need to be on seperate layers or something?
I seem to remember reading something about declaring movie
clips as mask layers using actionscript but I've searched and found
nothing.
Any help or advice on this much appreciated.
Cheers,
Minky.
:)Luxury Mince Pie wrote:
> I'm trying to use a movie clip as a mask layer. The
movie clip contains both
> lines and fills. The fill areas are working perfectly
but the lines are
> appearing all weird and streaked (it's actually quite
cool looking but not what
> I'm ideally after). The masked layer is just a block of
plain colour fill. Has
> anyone had the same problem as me and if so is there a
work around? Do lines
> and fills need to be on seperate layers or something?
Outlines can't be use as mask, they simply won't show up at
all. Outlines need to
be converted to solid fills.
> I seem to remember reading something about declaring
movie clips as mask
> layers using actionscript but I've searched and found
nothing.
search for setMask in your help files.
Best Regards
Urami
"Never play Leap-Frog with a Unicorn."
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
I am having difficulty with some movie clips under a mask. I
have a large movie clip with thumbnail photos underneath a mask.
The thumnails slide up and down using a scroll bar that is linked
through action script. When a thumbnail is clicked, it triggers
another movie clip to appear on stage. My first four work, but once
I have to scroll the fifth one into view, the fifth thumbnail
doesn't even register as clickable. Any thoughts?I removed the mask, and tested the movie after adding a trace
to the fourth thumbnail. It still came up undefined, even after I
used the target feature to call it. Any other thoughts? The fifth
thumbnail also came up undefined. All the thumbnails are labeled
printThumb#_mc, where # is the number of the thumbnail. -
Using Events To Play Another Movie Clip
Dear Readers:
I have a set of buttons in my flash movie that, when a mouse
cursor passes over it, another movie clip on the stage causes a
layer with text to gradually appear from below. It pops up, so to
speak, and eventually stops, displaying the text related to the
button in full view.
Passing over a different button causes the text layer to move
downward, slowly disappear off the stage, then reappear in the same
manner with text associated with that latest button. Its fairly
simple and works fine, as long as the user waits patiently for the
text layer to scroll down and back up before passing over another
button. See code below.
However, if the user decides to quickly pass over multiple
buttons (before the text layer reaches the top), the event handler
is coded such that if the mouseover event occurs BEFORE the text
layer reaches the top, the text layer starts over at the bottom, so
the transition is not smooth. Imagine the text layer just about to
reach the top, when the mouseover event occurs, now the text layer
starts over from the bottom. Very choppy.
I'd like to grab the current frame of the text layer movie
clip when the mouseover event occurs, and have the layer move back
down from there, reach the bottom, then come back up, rather than
starting from the bottom. Any help in coming would be great. Thanks
in advance.yourI = setInterval(f,t) starts a loop. it repeatedly calls
the function f() every t milliseconds until a clearInterval(yourI)
is executed.
the most common problem that occurs with setInterval() is
executing it twice (or more) with no intervening clearInterval().
when that happens all hell breaks loose and the swf will call the
function much more rapidly than intended and can not be (easily)
stopped no matter how many clearInterval() statements you try and
execute.
the easiest way to prevent that problem is to execute a
clearInterval() just BEFORE all setInterval() statements. it
doesn't hurt anything to (try and) clear and interval that doesn't
exist and occasionally it'll stop the seemingly bizarre problems
that occur with out-of-control intervals:
clearInterval(yourI);
yourI=setInterval(f,t); -
How load variables to a movie clip on a masked layer on my main time line
the problem I have is that I been trying to load text from a
text file news.txt into a movie clip on my main time line the
problem is when the layer where the video clip is locates is masked
the variables will not load, but it does work when the layer is
unmasked, but then the website does not work the way it is suposed
to look.
any Idea on how I can get arround this????PArt of the problem will be due to declaring the uiLoader inside of a function. When you do that you limit its scope to within that function. You should declare it outside of any function if you need to access it in more than one function.
import flash.events.MouseEvent;
import fl.motion.MotionEvent;
var uiLoader:UILoader;
var targetObj:Object;
The other problems I see regard the line you point to. It is not spelling the name the same, using a lowercase "l". Also, if you want to target what the UILoader contains, you should target its "content" property, as in...
targetObj = uiLoader.content.mask_01 -
Can anyone point me in the right direction?
I've been playing around with making a draggable movie clip.
This movie clip appears within a container, holder_mc, which is
masked by a mask layer to control what is seen. I can drag
holder_mc around the screen, but the mask does not move with it.
When I hit the movie_btn, I cannot see my VideoPlayer.swf file. If
I do not drag holder_mc anywhere, and just press my movie_btn, I
cannot drag my swf file. Is there an easy way to have the mask and
holder_mc drag together, and have drag functionality even after my
swf is playing?
Here is what I'm using:
movie_btn.onRelease = function (){
holder_mc.loadMovie ("VideoPlayer.swf");
holder_mc.onPress = function(){
this.startDrag(false);
holder_mc.onRelease = function(){
stopDrag();
Thanks for any help.Couple of ways... simple enter_frame, or enter_frame TweenLite
addEventListener(Event.ENTER_FRAME, updateReflection, false, 0, true);
function updateReflection(e:Event):void
refClip.x = mouseX;
refClip.y = mouseY;
or using TweenLite to give it a little softer motion:
function updateReflection(e:Event):void
TweenLite.to(refClip, .5, {x:mouseX, y:mouseY}); -
Drop menus with mask and invisible movie clip
please see this navigation interface:
http://www.hearightnow/yogamater/
when the mouse is outside of the drop menus, the drop menus "hide" behind the outside of a mask, when the mouse enters the drop menus, they move up. An invisible movie clip the traces the frame of the photos is in place to insert ROLL_OVER and ROLL_OUT code to "block" the event listener that functions the "yoga" drop menu.
This is all done in one frame, the scripts do all the animation of the drop menus.
the current code for this menu allows the mouse to travel from the photos to the "yoga" drop menu without triggering the menu to go up, however if the mouse travels from the "yoga" drop menu to the photos, the drop menu locks up until the mouse leaves the photos.
any ideas how this can be fixed? also, how do I apply the script on the invisible clip to all the drop menus?
definitely a newbie to AS3 so all help is greatly appreciated!!
here is the main script:
stop();
addEventListener(Event.ENTER_FRAME,upyoga);
addEventListener(Event.ENTER_FRAME,upteach);
addEventListener(Event.ENTER_FRAME,upsched);
addEventListener(Event.ENTER_FRAME,uppriv);
addEventListener(Event.ENTER_FRAME,upcont);
var speed:Number=.222;
function upyoga(e:Event) {
if ((yoga_menu.mouseY<yoga_menu.height&&yoga_menu.mouseY>0) &&
(yoga_menu.mouseX<80&&yoga_menu.mouseX>0)) {
yoga_menu.y-=(-58+yoga_menu.y)*speed;
} else {
yoga_menu.y-=(-134+yoga_menu.y)*speed;
function upteach(e:Event) {
if ((teach_menu.mouseY<teach_menu.height&&teach_menu.mouseY>0) &&
(teach_menu.mouseX<80&&teach_menu.mouseX>0)) {
teach_menu.y-=(-65+teach_menu.y)*speed;
} else {
teach_menu.y-=(-118+teach_menu.y)*speed;
function upsched(e:Event) {
if ((sched_menu.mouseY<sched_menu.height&&sched_menu.mouseY>0) &&
(sched_menu.mouseX<80&&sched_menu.mouseX>0)) {
sched_menu.y-=(-42+sched_menu.y)*speed;
} else {
sched_menu.y-=(-96+sched_menu.y)*speed;
function uppriv(e:Event) {
if ((priv_menu.mouseY<priv_menu.height&&priv_menu.mouseY>0) &&
(priv_menu.mouseX<80&&priv_menu.mouseX>0)) {
priv_menu.y-=(-28+priv_menu.y)*speed;
} else {
priv_menu.y-=(-74+priv_menu.y)*speed;
function upcont(e:Event) {
if ((cont_menu.mouseY<cont_menu.height&&cont_menu.mouseY>0) &&
(cont_menu.mouseX<80&&cont_menu.mouseX>0)) {
cont_menu.y-=(-40+cont_menu.y)*speed;
} else {
cont_menu.y-=(-88+cont_menu.y)*speed;
and here is the script on the invisible clip:
invisiClip.addEventListener(MouseEvent.ROLL_OVER, invisClipOver);
invisiClip.addEventListener(MouseEvent.ROLL_OVER, menuBack);
invisiClip.addEventListener(MouseEvent.ROLL_OUT, invisClipOut);
function invisClipOver(event:MouseEvent):void {
removeEventListener(Event.ENTER_FRAME,upyoga)
function menuBack(e:Event) {
yoga_menu.y-=(-134+yoga_menu.y)*speed;
function invisClipOut(event:MouseEvent):void {
addEventListener(Event.ENTER_FRAME,upyoga)I was having trouble attaching a zip or fla to this post so they can be retrieved at
http://www.hearightnow.com/yogamater/menu_45b.zip
or
http://www.hearightnow.com/yogamater/menu_45b.fla
the "menu" layer contains the mask that the drop menus hide behind
the "invis" layer contains the invisible movie clip that has the code that removes and adds the event listeners that move the "yoga" drop menu
the photos seen at http://www.hearightnow.com/yogamater/ are added with HTML DIV tags.
thanks! -
Masking a movie clip that contains other movie clips
hi,
i am just trying out something in flash but it just doesnt
work.
I have a layer which has a movie clip which contains other
movieclips in itself.
Masking the layer that has the main movie clip causes the
other movieclips in the main one to disappear when running the swf.
Does any one have any idea how to get around this???
thanksHi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
Mask works in movie clip, not in scene
I've created a movie clip with a mask that I'm using in a
main scene. The mask looks fine while editing/working the movie
clip, but does not show up in the scene.
The really strange thing is that it was working, but suddenly
now it won't show up in the scene any longer. I've tried replacing
it, making a new layer and bringing it in again. But nothing works.
Does anyone have an idea of why this would be?
Any help GREATLY appreciated!
dmscenes are nothing more than the main timeline divided.
Nothing different from one scene to the
other in terms of layer and frame functionality - sounds to
me like you simply dont have the mask
and masked layers locked in that scene.
~~~~~~~~~~~~~~~~
--> Adobe Certified Expert
--> www.mudbubble.com
--> www.keyframer.com
~~~~~~~~~~~~~~~~
dkmiles wrote:
> I've created a movie clip with a mask that I'm using in
a main scene. The mask
> looks fine while editing/working the movie clip, but
does not show up in the
> scene.
>
> The really strange thing is that it was working, but
suddenly now it won't
> show up in the scene any longer. I've tried replacing
it, making a new layer
> and bringing it in again. But nothing works.
>
> Does anyone have an idea of why this would be?
>
> Any help GREATLY appreciated!
>
> dm
> -
Help with smooth scrolling (masked movie clip)
Ok, I really need help here, and I'll be very grateful for
help before Monday.
Someone has made a movie with a different set of text on each
frame, the text goes out of the viewable area.
I have been asked to make these frames appear in a pop-up on
another flash and be scrollable.
i thought this would be easy...just cut and paste them into a
movie clip, then using a mask to hide the rest of the text.
However, it is going painstakingly slow.
Seems to be a performance issue, but it might be my code.
Any help with the code, or optimisation elsewhere would be
helpfully.
Heres a simplified version of the flash;
www.darkflame.co.uk/flashwork/Flash_popuptest.fla
Code for the scrolling;
_global.MoveUp = function(text) {
_root.ITproduct.IT_productlist._y =
_root.ITproduct.IT_productlist._y+6;
updateAfterEvent();
//trace('press');
Called and stopped by;
on (press){
//this._parent.IT_productlist._y =
this._parent.IT_productlist._y +10;
//_global.scrollon = "yes";
clearInterval(IntervalID);
IntervalID = setInterval(MoveUp,100);
updateAfterEvent()
//updateAfterEvent();
//MoveUp();
//scroll on
on (release) {
//this._parent.IT_productlist._y =
this._parent.IT_productlist._y +10;
clearInterval(IntervalID);
updateAfterEvent();
//scroll off
which is linked to a button.
I dont know if this is a actionscript problem, or the way the
page is made, or both.
Any help would be appreciated.
Thanks in advance,
Thomas Wrobelyou have extraneous graphics on-stage that are slowing the
scrolling (and even causing problems in the authoring environment).
here's your file with those graphics removed:
http://www.gladstien.com/Files.popupTest.fla -
Hi,
when I try to load a movie in a masked movieclip/placeholder
the clip
isn't loaded. When I check for getBytesTotal() it still is 18
bytes like
the paceholder. When I put the mask away the clip is loaded.
Can I have both?
TIAJust read your post in google groups, for some reason I can't
see it on
the newsgroupserver.
The problem ist that is just not loaded when there is a mask
on it. It
is just ignored without any error message or anything. Have
done it
without a mask now. Seems to be a bug or something. -
How do I "mask" or blurr out sections of movie clips saved in windows media format in After Effects
I was informed that I needed to use After Effects to "mask" or blurr out sections of movie clips saved in windows media format.
I have the movie clip in composition, I see the effects and presets drop box on the lower right.
How do I insert the text blocks to mask certain areas of the movie clip?
Thank you,
PrestonGetting started with After Effects (CS4, CS5, CS5.5, CS6, & CC) | After Effects region of interest
There's seriously nothing more to say. Watch some tutorials, read the help, learn the program.
Mylenium -
Importing AI Layer Names as Movie Clip Names?
Hi all,
We've got an Illustrator file with something over 1,000 layers. We're trying to import this into Flash and keep the layer names intact, such that they become the names of the movie clips that are imported for each layer and can be used programmatically. (It is a diagram and arrows, boxes, etc all have callout names that will eventually allow them to link to a database.)
As near as I can tell, the Import dialog will NOT pass this info across between the two parts of the dialog. Anyone have a magical suggestion for how to make it do so? We're using Flash CS4, but I have access to CS5 too if that will help.
Thanks in advance,
Eric.I give up.
Dear Adobe/Macromedia engineer in charge of the Illustrator Import Filter. Please DIAF. All you had to do was copy the damned layer name across the panel into the Instance name field, but that would make it too easy!
So, I figured I'd script around it. Wrote an Applescript that changes the color and transparency of every single item in the entire document to be unique and generates a text file annotating what was what. Then I tried to import it into Flash so that I could use that text file to reapply names to everything. IMMEDIATELY stymied though, because the effing Illustrator->Flash importer is inaccurate as HELL about what transparency number actually gets imported. I needed to use 0.1% transparency increments to be able to accomodate enough groups. As near as I can tell Flash barely supports 1% increments accurately though! WHAT THE HELL?!
Anyways, sorry for venting, but the experience is soooo typical of the crap you run into trying to get anything done in Flash...
Argh. -
Mask - movie clip loaded from .swf
Hi!
I have made an application where a movie clip (map_mc) is
masked by another movie_clip (map_window_mc:
map_mc.setMask("map_window_mc");
This works fine until I try to load an "external" .swf into
map_mc:
map_mc.loadMovie("Testmap.swf");
Then the mask does not work anymore......
Any suggestions?
(The testmap.swf is also displaced from map_mc.........)
I use Flash 2004 MX pro
terjemterjem,
> My problem is probably that I really don't know wath
event
> handler I should use...
Depending on the approach you're using, there may not even
be an event
handler when the external SWF loads. If you're using the
MovieClipLoader
class, there will be. If you're using a
MovieClip.onEnterFrame loop, there
won't be.
> Here is the first ("non-automatic") code that works:
Okay.
> map_mc.loadMovie("Testmap.swf");
> trace("Loading started!");
> this.onEnterFrame = function() {
> if (
> map_mc.getBytesLoaded() > 0 &&
> map_mc.getBytesLoaded() >= map_mc.getBytesTotal()
> ) {
> trace("Loading complete!");
> trace("File width: " + map_mc._width);
> delete this.onEnterFrame;
> } else {
> trace("File width: " + map_mc._width);
> }
> };
Okay. So far, so good. When bytes loaded is greater than
zero and
greater than or equal to bytes total, you'll know the
external SWF has fully
loaded. You'll know, because the "Loading complete!" trace
will be visible
in your Output panel. Well, that means the place in this
script that
represents "where to put additional code" is right were your
trace()
functions are. Not in the "else" clause, but the first one
this.onEnterFrame = function() {
if (
map_mc.getBytesLoaded() > 0 &&
map_mc.getBytesLoaded() >= map_mc.getBytesTotal()
trace("Loading complete!");
trace("File width: " + map_mc._width);
[delete these trace() functions, if you like]
[add your masking code here]
delete this.onEnterFrame;
// etc.
> The code below does not work (the positioning of the
> map_mc works, but not the setMask):
Your problem may be right here ...
> map_mc.setMask("map_window_mc");
... because "map_window_mc" is in quotes. Yes, the
ActionScript Language
Reference says the parameter of setMask() may be a string,
but leave the
quotes out and see what happens. In any case,
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
How to stop a slideshow and show another movie clip at the end?
Currently my slideshow is in a loop. At the end of last slideshow, I want to show another movie clip (End_mv) that's on another layer. How do I do that? My current scripts are below:
import fl.transitions.Tween;
import fl.transitions.easing.*;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
sound.play();
function init():void
// create new urlloader for xml file
xmlLoader = new URLLoader();
// add listener for complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
// load xml file
xmlLoader.load(new URLRequest(strXMLPath));
// create new timer with delay from constant
slideTimer = new Timer(TIMER_DELAY);
// add event listener for timer event
slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
// create 2 container sprite which will hold the slides and
// add them to the masked movieclip
sprContainer1 = new Sprite();
sprContainer2 = new Sprite();
mcSlideHolder.addChild(sprContainer1);
mcSlideHolder.addChild(sprContainer2);
// keep a reference of the container which is currently
// in the front
currentContainer = sprContainer2;
function onXMLLoadComplete(event:Event):void
// create new xml with the received data
xmlSlideshow = new XML(event.target.data);
// get total slide count
intSlideCount = xmlSlideshow..image.length();
// switch the first slide without a delay
switchSlide(null);
function fadeSlideIn(e:Event):void {
// add loaded slide from slide loader to the
// current container
currentContainer.addChild(slideLoader.content);
// clear preloader text
//mcInfo.lbl_loading.text = "";
// fade the current container in and start the slide timer
// when the tween is finished
//Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
//scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
slideTimer.start()
onComplete:function();
function switchSlide(e:Event):void
// check, if the timer is running (needed for the
// very first switch of the slide)
if(slideTimer.running)
slideTimer.stop();
// check if we have any slides left and increment
// current slide index
if(intCurrentSlide + 1 < intSlideCount)
intCurrentSlide++;
// if not, start slideshow from beginning
else
intCurrentSlide = 0;
// check which container is currently in the front and
// assign currentContainer to the one that's in the back with
// the old slide
if(currentContainer == sprContainer2)
currentContainer = sprContainer1;
else
currentContainer = sprContainer2;
// hide the old slide
currentContainer.alpha = 0;
// bring the old slide to the front
mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
//txtField.border = true;
//txtField.x = 0;
//txtField.y = 600;
txtField.width = 855;
txtField.height = 200;
//txtField.background = true;
//txtField.backgroundColor = 0xEE9A00;
txtField.alpha = 20;
txtField.text = strDescrp;
formatText.align = TextFormatAlign.CENTER;
//txtField.autoSize = TextFieldAutoSize.LEFT;
formatText.color = 0x000;
formatText.size = 30;
txtField.x = 0;
txtField.y = 550;
posX = 0;
posY = 0;
degreeRot = 0;
// create a new loader for the slide
slideLoader = new Loader();
// add event listener when slide is loaded
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
// load the next slide
slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));
addChild(txtField);
txtField.setTextFormat(formatText)
// init slideshow
init();I got this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/swapChildren()
at University_Advancement_Holiday_Greeting2012_fla::MainTimeline/switchSlide()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
And here's the code:
// import tweener
//import caurina.transitions.Tweener;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//var myEnding:MovieClip = stage.getChildByName('End_mc') as MovieClip;
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
sound.play();
function init():void
//reference my movie clip "End_mc" oon the stage and turn its visibility off
MovieClip(getChildByName('End_mc')).visible = false;
// create new urlloader for xml file
xmlLoader = new URLLoader();
// add listener for complete event
xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
// load xml file
xmlLoader.load(new URLRequest(strXMLPath));
// create new timer with delay from constant
slideTimer = new Timer(TIMER_DELAY);
// add event listener for timer event
slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
// create 2 container sprite which will hold the slides and
// add them to the masked movieclip
sprContainer1 = new Sprite();
sprContainer2 = new Sprite();
mcSlideHolder.addChild(sprContainer1);
mcSlideHolder.addChild(sprContainer2);
// keep a reference of the container which is currently
// in the front
currentContainer = sprContainer2;
//function onXMLLoadComplete(e:Event):void
function onXMLLoadComplete(event:Event):void
// create new xml with the received data
xmlSlideshow = new XML(event.target.data);
// get total slide count
intSlideCount = xmlSlideshow..image.length();
// switch the first slide without a delay
switchSlide(null);
function fadeSlideIn(e:Event):void {
// add loaded slide from slide loader to the
// current container
currentContainer.addChild(slideLoader.content);
// clear preloader text
//mcInfo.lbl_loading.text = "";
// fade the current container in and start the slide timer
// when the tween is finished
//Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
//scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
slideTimer.start()
onComplete:function();
function switchSlide(e:Event):void
// check, if the timer is running (needed for the
// very first switch of the slide)
if(slideTimer.running)
slideTimer.stop();
// ADDED: Check if using sprContainer2 and at the last slide
//if ((currentContainer == sprContainer2) && (intCurrentSlide == intSlideCount))
trace("Current Slide: " + intCurrentSlide);
trace("SlideCount: " + intSlideCount);
if ((currentContainer == sprContainer2) && ((intCurrentSlide + 1) == intSlideCount))
// hide the slideshow (and other related elements, or remove them if desired)
//mcSlideHolder.visible = false;
// remove any clips directly inside slideshow (any timers/etc need to be stopped too)
while (mcSlideHolder.numChildren > 0)
mcSlideHolder.removeChildAt(0);
// I do see a var named 'sound' playing so you might want to:
//sound.stop();
//sound = null;
// etc any other slideshow-only elements to hide/remove..
// play your movie
MovieClip(getChildByName('End_mc')).visible = true;
MovieClip(getChildByName('End_mc')).play();
// check if we have any slides left and increment
// current slide index
if(intCurrentSlide + 1 < intSlideCount)
intCurrentSlide++;
// if not, start slideshow from beginning
else
intCurrentSlide = 0;
// check which container is currently in the front and
// assign currentContainer to the one that's in the back with
// the old slide
if(currentContainer == sprContainer2)
currentContainer = sprContainer1;
else
currentContainer = sprContainer2;
// hide the old slide
currentContainer.alpha = 0;
// bring the old slide to the front
mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
//strSource = xmlSlideshow.image[intCurrentSlide].@src;
//txtField.border = true;
//txtField.x = 0;
//txtField.y = 600;
txtField.width = 855;
txtField.height = 200;
//txtField.background = true;
//txtField.backgroundColor = 0xEE9A00;
txtField.alpha = 20;
txtField.text = strDescrp;
formatText.align = TextFormatAlign.CENTER;
//txtField.autoSize = TextFieldAutoSize.LEFT;
formatText.color = 0x000;
formatText.size = 30;
txtField.x = 0;
txtField.y = 550;
posX = 0;
posY = 0;
degreeRot = 0;
// create a new loader for the slide
slideLoader = new Loader();
// add event listener when slide is loaded
slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
// add event listener for the progress
//slideLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
// load the next slide
slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));
addChild(txtField);
txtField.setTextFormat(formatText)
// init slideshow
init();
Maybe you are looking for
-
HT5318 cannot open itunes on windows 7 64 bit
I am no longer able to open iTunes on windows 7 64 bit. Have tried "repair" option and remove and redownload.
-
Upload program for vendor master
Hi Friends, Could you please help me in this. actually i have a program like this: i have to download the data from an excel sheet and reformat it and output into a text file so that the data can be uploaded into vendor master using standard progarm
-
Hi experts, Need help with IDOC. I'm creating 2 FM to process an existing idoc. first FM will use the data from idoc 1 to populate EDIDD for idoc 2. second FM will use the data from idoc 2 to populate EDIDD for idoc 3. when during processing, I encou
-
BackPRD.log File Suddenly Increases to 78GB in SAPBACKUP folder in Linux server
Dear Experts, There is a problem in our SAP Production server. As earlier when i check the space it is good and after 25 Minutes while i am checking of the Directory spaces, the Backup folder size increases suddenly to 100 more than earlier it is. Th
-
Finder window preferences won't work
hi, i don't seem to get working where the new finder window opens. in Finder Preferences, under General i have selected Documents for the new finder window to open but it still opens in Machintosh HD. i've tried Home and Computer but it doesn't work