ActionScript 2.0 :: Simple Fade In And Out Function?
Oct 18, 2007
function that I can re-use and pass movie clips to and cause mc's to fade in and out?...such as
Code:
function fadeMeIn(fadewhat,fadespeed) {
if (fadewhat < 100) {
[code]......
View 6 Replies
Similar Posts:
Dec 12, 2006
this code is so not working, am i missing something very subtle?all it does is fade in and out an object when you roll over it.
_root.block2.tn.onRollOver= function(){
glow = true
}
[code]........
View 14 Replies
Aug 19, 2009
i am trying to fit gallery to my needs and actually i stop on problem with fading in and fading out. What i wanna do is fade in new picure on last visible picture - so last picture is still visble in backgroun when new one is fading in on same place and so on.
here is code that load the images (i also attached fla file cs3):
Code: Select allp = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
[Code].....
View 1 Replies
Jul 14, 2003
I am trying to have a simple swf with a static background image that will have phrases at random locatoin slowly fade in, stay for a few seconds,and then fade out. Then the next phrase, and the next one,and then next one,until it loops arround again. The phrases are coming from a database,and I have already created my asp code to give me a page with &phrase=phrase1,phrase2,phrase3,...&status=1&. My fla file has two layers--one for the background and the other for a movie clip wich contains a dynamic text field. My first frame loads my variables, and my second frame looks to see if status equals 1 (the last variable being loaded). If status is not equal 1, I send the head back to frame 1, otherwise I split the phrases into an array, get the height and width of the swf, and init a count var to 0.
Code:
//Look for a way to test the number of times the loop back to frame 1
//has been doen so that we can set a time out. Additionally, maybe put
//logic in the system to test for a blank services?
if (_root.status == 1) {
[code]....
However, many parts of that code does not work. I broke the math stuff up so that I could see the values in debug. Anyhow, Text_Width and Text_Height are undefined, which causes Text_X and Text_Y to be calculated for positions that may put the text off screen?
View 2 Replies
Oct 11, 2004
I've been trying to get a simple fade out of a logo to work. I converted the logo to a movieclip called logo_mc I click on the logo_mc movieclip and insert this actionscript.
onClipEvent (load) {
if (this._alpha>0) {
this._alpha -= 5;
}
}
I have also tried putting the code on the main timeline without any success.
If I understand correctly this should see if the alpha is greater than 0 and if it is it should decrease the value by five increments until it reaches 0.
View 3 Replies
Oct 11, 2004
I'm new to the forums and to actionscript. I've been trying to get a simple fade out of a logo to work. I converted the logo to a movieclip called logo_mc I click on the logo_mc movieclip and insert this actionscript.
[Code]...
I have also tried putting the code on the main timeline without any success. If I understand correctly this should see if the alpha is greater than 0 and if it is it should decrease the value by five increments until it reaches 0.
View 6 Replies
Nov 22, 2004
In order to fade-in 3 Movieclips that I have in 1 frame, I'm using this AS code for each MC:
[AS]
setProperty (MC1, _alpha, 0);
setProperty (MC2, _alpha, 0);
setProperty (MC3, _alpha, 0);
[code]....
It all works fine, the fade-in effect is accomplished but I've found out that Flash keeps on checking over and over if the condition is made (although it has already reached the 100 alpha value). The result is that the Flash movie eats almost any computer's resources up to 100% because it keeps on checking these 3 values endlessly.Is there a way to tell Flash to stop checking these values once the condition is reached (true)? Or is there another way to get the same result with a similar AS code?
View 3 Replies
Jan 24, 2007
I am aiming to create a looping array of images so that each fades in and fades out again ... here is the code i have so far ... it works EXCEPT ... it stops at the end of the array and appears to jump or hop a little between images ... want it to be smoother.
Code:
var aImages:Array = new Array("flashcontent.png", "flashcontent2.png", "flashcontent3.png");[/quote][quote]
var imageFolder = "../images/";
var fadeRate:Number = 1;[code]....
View 1 Replies
Dec 18, 2007
I'm learning how to tween instances using AS and not the timeline but I've run into a rather odd little problem regarding Alpha fades. It seems that the instance I'm fading in only remains on screen for a while (a minute or two) and then promptly disappears. Similarly in a simple slideshow I've made (where the images just fade in over the top of one another) the second rotation runs without a fade in/out.
Here's the code I'm using attached to the instance:-
On clipEvent (enterFrame);
instance = +10
View 9 Replies
Aug 1, 2009
I have a simple text fade movie clip that will "play" but won't work when I "Test Movie." What am I missing? I don't regularly use Flash as of yet, and have been successful before, but this is ridiculous - and I know I'm probably missing something very simple.
View 3 Replies
Jun 30, 2009
I seem to be having trouble with TweenLite in AS2.I've created a class which I call on the main timeline. Within the class I've loaded images and once they are loaded I want to fade between them. I am calling (inside my class) the following code when the images have finished loading:
TweenLite.to(_root["loadedimg1"], 1, {_alpha: 100,
onComplete:doImageLoop, onCompleteParams:[1], onCompleteScope:this});
I then have the following function to do the fade loop:
public function doImageLoop(imageId:Number):Void
{
trace(imageId);[code].....
This function never gets hit but this first image does fade up.
View 1 Replies
Jan 9, 2012
I have this problem when I try to fade in sound with the function below. It just doesn't work and I can't figure out where the problem is.I would like to fade in a looping sound but nothing happens.this is used to play a sound via events
dispatchEvent(new CustomEventSound(CustomEventSound.PLAY_SOUND, Main.SOUND_AMBIENT, false, true, false, 999999, 0, 0, setSoundVolume));
this is the function to play a sound. the stop-function is almost identical to this one.
public function playSound(soundName:String, isSoundTrack:Boolean = false, fadeIn:Boolean = false, fadeOut:Boolean = false,
loops:int = 1, offset:Number = 0, volume:Number = 1):void {
if (fadeIn) {
tempSoundTransform.volume = 0;
[code].....
View 1 Replies
Feb 13, 2006
I am trying to use fade in function for loader.loadMovie(this.main), but if I change the code 'loader.loadMovie(this.main)' to fade_in(loader.loadMovie(this.main)', it only can running for first frame, then stuck.
this.thumbHolder.onRelease = function() {
loader.loadMovie(this.main);
title_txt.text = this.title;
};
View 14 Replies
Nov 17, 2011
I have been searching the net for a tutorial how to graph functions. I found one from Barbara Kaskosz, very detailed, and too much scripting. Too much for me. Is there another way or place to learn, or I am doomed, and have to face the music and study her stuff. All I want, is to be able to graph a simple function.
View 4 Replies
May 29, 2011
I thought I would share a simple pad string function I created briefly... I know that there may be other similar functions already out there but I decided to make it anyway. It's basically a ripped off as3 version of the str_pad() php function.
Examples:
trace(stringUtils.stringPadLeft('7',4,'0','left')) ; // Traces 0007
trace(utils.stringPadLeft('whatever',2,'~','left') ); // Traces whatever
trace(utils.stringPadLeft('hi',20,'-','left')); //Trace ------------------hi
[code]....
View 2 Replies
Apr 20, 2010
I have the following functions that fade a movie clip in and out
Code:
fadeAmount = 1;
function fadeIn() {
this._alpha += fadeAmount;
if (this._alpha>=100) {
this._alpha = 100;
this.onEnterFrame = null;
[Code] .....
And then I call the movie clip to start fading in and appear on stage
Code:
contentMC._alpha = 0;
contentMC.onEnterFrame = fadeIn;
What I need is some way to tell the movie "after you reach alpha 100, stay there for x seconds and then fade out" and execute this code:
Code:
contentMC._alpha = 100;
contentMC.onEnterFrame = fadeOut;Aafter it reaches alpha = 0 it should stop and stay there without looping back and starting to fade in again.
View 2 Replies
Jan 19, 2011
I've been tinkering with it for 2 days now but can't fix it! I have a button that controls a movieclip (showstations1) that fades in and out. And i have a second button (button5) that gotoandplays on the main timeline. The trick is I want the second button to fade out the movieclip if it's visible before it gotoandplays the main timeline. [code]...
View 3 Replies
Aug 19, 2004
OK, trying to fade out a button through a function. I've done this before but I'm tired and it's just not happening. OK, there's a button named "button" and a movieclip named "fadeThis". The first frame of the root has the following code in it:
[Code]...
View 8 Replies
Nov 18, 2011
Well I'm so close to understanding why this doesn't work. First here is the code:
Code:
import flash.display.MovieClip;
stage.addEventListener(Event.ENTER_FRAME,updateGame);
var gameZoneContainer:MovieClip = new MovieClip();
stage.addChild(gameZoneContainer);
[Code]......
If I place "fish_mc" in place of "Items[createItemCounter]", the fish animates but the cookie doesn't. If I put "cookie_mc" instead of "Items[createItemCounter]", the cookie animates but the fish doesn't.
View 2 Replies
Oct 29, 2009
For each product a label is created determing its category unless a label of that category has already been created before. My while loop is supposed to stop the same label being created twice but apparently it doesnt! My function consists of an array of categories (kategorie[]) and an array of labels that were previously created (previousLabels).
[Code]...
View 4 Replies
Mar 11, 2010
I made a simple app with 2 movieclip symbols containing photos of a butterfly with this actionscript:
import fl.transitions.Tween;
import fl.transitions.easing.*;
butterfly_mc.addEventListener(MouseEvent.CLICK, bigPic);
butterflyHand_mc.addEventListener(MouseEvent.CLICK, bigPic);
function bigPic(e:MouseEvent):void{ new Tween(e.currentTarget,"scaleX",Strong.easeOut, e.currentTarget.scaleX, (e.currentTarget.scaleX * 1.4), 4, false);
[Code] .....
I don't get any error messages but when I click on case1_mc.c1_mc.case1a_mc or case1_mc.c1_mc.case1b_mc nothing happens.
View 11 Replies
Sep 8, 2009
I'm modifying an mp3 player by flabell, and try to get some buttons to work. However, I can't seem to get the getURL to work, even though it works in other parts of the script. This is my code:
mc.rate1.onRelease = function() {
trace(this.ID);
getURL("[URL]","_blank");
};
The trace goes through fine. Here is the code that works:
Code:
private function downloadRelease(mc : MovieClip) : Void {
var title : String = mc._name;
var index : Number = Number(title.substring(title.lastIndexOf("n")+1,title.length));
getURL(songsSource[index], Main.getInstance().mcAlbums.linksTarget);
}
I'm on a mac with firefox.
View 3 Replies
Mar 21, 2006
i've tried searching the forums and fighting with this way of fading the movie clip in and out. The movie clip has an instance name of "box", my brother also can't figure it out.
Code:
var fadeChecker:Boolean = true;
function flicker():Void{
if(box._alpha >= 100){[code].....
View 5 Replies
Aug 28, 2006
basically i have a mc that i want to use as a button.
frame 1 is the initial state with a stop() action on it. frame 10 is the full rolled over state, also with a stop() action on it, and frame 20 matches frame 1.
so basically i want the button to animate frame 1-10 if they rollover, and animate frame 11-20 when they roll off. i would also like it to detect the current frame, so like if the user rolls off and rolls back on at frame 15, it will play backwards to the mouseover state (frame 10).
View 3 Replies
May 9, 2007
create a button, create a movie clip with two frames.
place a button instance in frame 2.
place a mc instance on the stage.
create another instance of the button to change the movie clip instance to frame two.
the button in the movie clip is pressed and executes a function.
here's the code
Code:
// create the button to show the button!
_root.button_instance_2.onPress = function() {
buttonClick1();
[Code].....
if, however, i use the same code on a movie clip that has only one frame it will work fine. do i need to tell the function to target the button instance any more specifically than that?
View 2 Replies
Oct 18, 2004
basically I have an MC menu that I want to move to the left when you click and hold on another MC called leftButton, here's what I have.In main timeline:
Code:
menu.moveLeft = function() {
this._x -= 4;
[code]......
View 10 Replies
Jan 4, 2012
I'm a newcomer to Actionscript programming and trying to modify a Flash site template downloaded from [URL] (which is an AS2 template). I've almost succeeded at what I need to do but have run into a couple of brick walls. One is that I've added a video player to the site and need to make the background music track smoothly fade out when the video starts and fade back in when it ends (or is stopped). I set up a listener object for the video player that works. It's the smooth fade of audio levels that doesn't.
[Code]...
View 15 Replies
Nov 16, 2004
I have a function on root:
_root.fadeBox_mc.onEnterFrame = function (){
if (fade){
this.nextFrame();
} else {
this.prevFrame();
[Code]...
This causes a mc to fade in and out on rollover/rollout. But what I wanna make is a box that fades in when pressed on the button and fade out when pressed for the second time. But if I say
on (press){
_root.fade = true;
}
the mc fades in, but I cant do another on (press) to fade out. Is this too confusing?
View 2 Replies
Jan 13, 2006
I have eight images in a MC that I would like to sequentially fade in, display for a few seconds and fade out using _alpha function. So far I can fade one in with this AS:
img1._alpha=0
img1.onEnterFrame = function() {
this._alpha +=10;
}
Assuming my instances are img1, img2, img3, etc, etc... how would I go about sequentially fading each instance from 0 to 100, letting it display on the stage for a few seconds and then fade out (like a slideshow)?
View 7 Replies
May 15, 2008
I'm making a gallery using XML data and loading the information into a mc instance that are in turn being attached to the stage via linkage id. My question is this: I need to make all of those instances fade out with a function, and I have created a for loop to do this, however it is not working.. Any suggestions on how to make it work?
[Code]...
View 2 Replies