Make Code Wait...
I am going to a function to build a big combo box, then selecting an item from it... but it seems that the select is trying to happen before the box is finished building... any ideas?
Thanks
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 09-18-2006, 09:55 PM
View Complete Forum Thread with Replies
Sponsored Links:
How To Make Code Wait For An Event?
Hello,
I'm trying to make a slideshow that dynamically loads pictures, fades them in, and fades out previous images.
I've made some progress: The pictures load, they fade in, but now I'm stuck.
I've created the functions- displayImage(), fadeUp() and fadeDown(),
Clicking on a button will call displayImage which will load an image, start a preloader movie clip, and once the preloader hits frame 100, it invokes fadeUp(), making the new image visible.
But now I want to make the previous image fade out. How can I add this to the displayImage definition? How can I make the code wait for this event? I added it bluntly at first in a similar way to this: (pseudo code)
Code:
function displayImage(...) {
if(there is an image already loaded) {
fadeDown(the image)
}
loadMovie(imageName, "placeHolder_mc"); //load new image
preloader_mc.gotoAndStop(2); //begin preloader
}
but of course, the code will call fadeDown and not wait for it to do its business.As a result, there is no fade down, and the code immediately activates the fadeUp for the new Image.
What's the best way to do this? Have I gone down completely the wrong path?
I thought of another way which was to specify a global variable (let's say var imChange:Boolean) which gets set High at the end of fadeDown. Then I added a while(imChange == FALSE) loop to displayImage to make it wait, but it crashed the Flash player.
anyway, my main question is, how can I arrange my code so that it performs functions in sequence? i.e. it waits for one function to finish before performing another?
Main timeline code pasted below. Note that the code that activates 'fadeUp' is located in the preloader_mc. Here's a link to the entire package (including images): http://www.zen26398.zen.co.uk/files/Imageloader.rar
and without the images: http://www.zen26398.zen.co.uk/files/...oader%202c.fla
If anyone can give me any tips i'd appreciate it, I'm trying to improve my technique. Thanks for reading
Code:
var imageName:String;
var sizeLoaded:Number;
var totalSize:Number;
var imChange:Boolean;
_root.createEmptyMovieClip("placeHolder_mc", 1);
placeHolder_mc._xscale = 20;
placeHolder_mc._yscale = 20;
placeHolder_mc._visible = FALSE;
function displayImage(num:Number) {
imageName = "Image"+num+".jpg";
loadMovie(imageName, "placeHolder_mc");
preloader_mc.gotoAndStop(2);
}
function fadeUp(targetMc_mc:MovieClip) {
trace("Fade up init");
var i:Number = 0;
targetMc_mc._alpha = 0;
targetMc_mc._visible = TRUE;
targetMc_mc.onEnterFrame = function() {
this._alpha = i;
i += 10;
if (i>=100) {
i = 100;
delete targetMc_mc.onEnterFrame;
}
};
}
function fadeDown(targetMc_mc:MovieClip) {
trace("Fade down init");
var i:Number = 100;
//targetMc_mc._alpha = 100;
//targetMc_mc._visible = TRUE;
targetMc_mc.onEnterFrame = function() {
this._alpha = i;
i -= 10;
trace(i);
if (i<=0) {
i = 0;
delete targetMc_mc.onEnterFrame;
}
targetMc_mc._visible = FALSE;
};
}
_root.button_btn.onRelease = function() {
displayImage(1);
};
_root.button2_btn.onRelease = function() {
displayImage(2);
};
_root.button3_btn.onRelease = function() {
displayImage(4);
};
View Replies !
View Related
How To Make My Code Wait Until Movie Is Loaded
I have an urgent problem.
In my code I have a loadMovie that loads an image onto a movieClip. I want this image to fade up and then some other things happen. The only problem is the fade and the other things happen BEFORE the movie shows up on the screen and that causes a lot of problems since the file is going to be online.
Is there a way I can tell the code to wait for the movie to load and then do the fade and the rest of the things?
here is the code:
im1_mc.loadMovie("image1.jpg");
//I want it to wait here until the image is loaded
im1_mc._alpha=0;
myFader(im1_mc,0);
Any help is appreciated,
E
View Replies !
View Related
How Do I Make It Wait Then Get Url?
im trying to figure out how to make my flash movie wait for a specified period of time and then load a url into the same browser window?
specifically, when the movie is over (a slideshow presentation), it waits for say 5 seconds, then it automatically loads up a separate web page into the same browser window (ie, not into a popup).
any advice greatly appreciated.
yjk
View Replies !
View Related
How Do I Make Flash Wait
I am creating a navigation bar which scrolls down, when you press a sub level link the movie scrolls back up again and then goes to the url. Well, that is the theory anyway. At the moment the page jumps staight to the url before the menu closes. Is there any way to make flash wait until the movie finishes playing before reloading the page?
View Replies !
View Related
Make Flash Wait
hello,
i need to crate a slideshow that loads jpgs dynamically from a certain location.
I found something on http://www.macromedia.com/support/fl...slideshow_xml/
Does anyone know how I could add a fade transition effect to this and an autoadvance button that cycles through the slides in 4second intervals...? I have some basic experience in flash but when it comes to higher action script it easily frustrates me
I don´t know how to make flash wait simple 4 seconds...arrrgh...
I tried so many different things but I just can´t figure out how to make flash wait for 4 seconds and my transition effect looks weird because the image pops up for a moment and then starts fading in.#
Thanks for any help...
Aloha from hawaii
Attila
View Replies !
View Related
Make LoadVars Wait
How can I make onLoad event of a LoadVars "wait" until all data is loaded and then proceed with the next lines of actionscript codes (on the same timeline/frame)?
var some_var = new LoadVars();
some_var .load(php_program);
slide_count.onLoad = function(success) {
if (success) {
trace("get here first");
}
};
trace("get here second");
View Replies !
View Related
Can I Make My Movieclip Wait?
I have an action that when a movieclip is clicked it is supposed to move to the top left of the screen. I have a FOR statement that is supposed to move it there in ten intervals, but the movieclip seems to jump right to the top left. Can I make each For loop pause for a small increment before it executes the next loop to make the movieclip appear to move to the top instead of jump?
var x:Number=movieClip._x;
var newx:Number=x/10;
var y:Number=movieClip._y;
var newy:Number=y/10;
for (var i:Number = 1; i<11; i++) {
x=(x-newx) ;
movieClip._x=x;
y=(y-newy) ;
movieClip._y=y;
}
View Replies !
View Related
Make An Animation Wait
my question is i have a frame (the 1st one) and i want the user to do something (drag an item to a certain place) then press a button to load an animation afterwards (only if the user has place the item where it's suppose to be). so my question is how do you do this?
View Replies !
View Related
Make A Function Wait...
Hiya,
Im developing a simple top trumps game (nearly done: www.head-spun.co.uk/guildwars/ ).
As you can see from the link above, when you play against the computer, it whizzes through its turns so the human player cant see what is going on. So I was wondering if there is any way of getting a function to wait before carrying out the next instruction...
function myFunction(){
computerTurnOverCard();
waitFor(3);
computerChooseAttribute();
waitFor(3);
completeTurn();
}
kinda thing? I cant think of hw to do it with code. I know I could call for a blank movie Xseconds long to play, then when it stops, call another function, but that way seems messy to me.
Thanks
Abi
View Replies !
View Related
Make One Movieclip Wait For Another
Hi, thanks for viewing,. Is there a way of scripting a mc so that it will gotoandplay once another (nested within it) has got to a ceratin frame i know it could maybe involve .curentframe? but can't get that to work. Is the simplest way to start action of parent clip at the frame at which the child clip has fin ished, in otherwords if child ios 15 frames long, begin action in parent at frame 16?
Many thanks
Frank
View Replies !
View Related
Wait...then Fire ActionScript Code
I have a site that uses a cloud moving across the sky effect (Cloud_mc).
I've used the following code to move the created MC across the screen horizontally to create this moving effect.
Code:
onClipEvent(enterFrame) {
speed = -.4;
this._x += speed;
}
Problem is that once the MC runs out of clouds, the area where the clouds should be appears blank.
I need to be able to do either of the following two tasks:
1. Play the effect for a period of time then auto-repeat the Clouds_mc
or
2. Play the effect and then redirect to an MC that has non-moving clouds.
Thanks for your comments and assistance!
SKURGE
View Replies !
View Related
How To Make A Frame Wait On A DB Query
Hello all,
I'd like the first frame of my movie to make a database connection to see if the DB is up. I already have this coded in PHP and it is working. It is the first frame of my movie. I would then like the 2nd frame to tell me the status. I am already passing the correct variables back from PHP. But it looks like the movie is going onto the 2nd frame without waiting for the DB query in the 2st frame to finish. Is there a way to make it wait? All the first frame PHP invoked code does is make a connection and return a status.
Followup...
The PHP that is invoked by the 1st frame is...
<?PHP
// Using variables for all connection information
$nativedsn = "phptest";
$user = "sa";
$pass = "";
$status = "Unavailable";
$conn = @odbc_connect($nativedsn, $user, $pass);
if (is_resource($conn))
{
$status = "Available";
}
echo $status;
echo $nativedsn;
?>
THanks
P
View Replies !
View Related
How Do I Make Flash Wait Until A .jpg Is Loaded
I'm loading in dynamic .jpgs and I want to get the width of one after it is loaded. The only problem is I have to click my button twice and load the pic twice for flash to recognize the width. The first time my trace returns zero. I know i need to setup some kind of function to check that it is loaded and then get the width, but I'm not sure how to check if something is loaded.
View Replies !
View Related
Make Function Wait For Variables
Plz help...
I need a function (that is called from a button) to pause in midstream until 2 variables are defined in another timeline. Currently, the function executes fully before the 2 variables get defined. I've tried adapting responses to similar forum questions, but can't get them to work in my project.
Basically, what happens is:
ActionScript Code:
button.on(release) {
_root.functionList();
}
function functionList() {
func1
func2
//func3 requires 2 variables defined on the "movieClip" timeline
func3
}
function func2() {
//do bunch of math to get x;
movieClip.gotoAndStop(x);
}
View Replies !
View Related
How Do I Make A Movie Wait For A FLV Cuepoint
I'm trying to synch a "talking head" FLV with some graphics, so I simply want to get my movie to wait for a cuepoint to begin playing again. I'm making it Flash 7 compatible, so I'm using the older Media Display component.
Is there a "stop" and "wait for cuepoint" that would work? If someone could give me the actionscript I should paste in the frame, it would be greatly appreciated, since I don't really know actionscript that well. Thanks.
View Replies !
View Related
Make Function Wait For MySQL
I am new at AS3...
I got an example of ASQL from http://asql.mooska.pl/
Now I am trying to create a function that can be called and return the Data from the database.
Problem is the function returns a value before the SQL is loaded.
Can anyone help? Here is the code:
Code:
package src{
import flash.display.Sprite;
import flash.events.*;
import src.mysql_query;
public class logon_main extends Sprite {
private var Data:Array = new Array;
private var my_query:String = new String;
public function logon_main() {
btnSubmit_1.addEventListener(MouseEvent.CLICK, btnSubmitclick);
}
function btnSubmitclick(m:MouseEvent):void {
my_query = ( "SELECT * FROM users u where userName='"+edtName_1.text+"'" );
Data = mysql_query.getData(my_query);
trace(Data[0].passWord);
}
}
}
Code:
package {
import pl.mooska.asql.*;
import pl.mooska.asql.events.*;
public class mysql_query {
public function mysql_query() {
}
public static function getData(my_query:String):Array {
var connector:Asql=new Asql;//creating instance of asql
var Data:Array=new Array;
connector.addEventListener(SQLEvent.CONNECT,handleConnect);
connector.addEventListener(SQLError.SQL_ERROR,handleError);
connector.addEventListener(SQLEvent.SQL_DATA,handleData);
connector.connect("MySQL-Server","User","Password","db_name",3306);//connecting to the server //arguments are host, user, pass, database, and port
function handleConnect(evt:SQLEvent):void {
trace("ASQL is connected");
connector.query(my_query);//The query
}
function handleError(evt:SQLError):void {
trace("Error catched " + evt.text);
}
function handleData(evt:SQLEvent):void {
trace("Final data received");
Data = evt.data;
connector.disconnect();
}
return Data;
}
}
}
View Replies !
View Related
How To Make Flash *wait* For Smth ?
hey, there, i've got a problem with flash communicating to outer scripts
i use the PHPObject http://ghostwire.com/go/28
and it's all good, but if for some reason the code in the php scripts is too slow to execute, the flash doesn't receive what it needs and it all ****s up..
so, i'm raising flags and if it's not ready i make the flash go looping.. but actually it's not so bright idea, because the calling to the method starts again etc..
so, may be there is a way to tell the flash 'stay here intil this and that happens?
any suggestions are welcome...
cheers
View Replies !
View Related
Grr.... Run Some Code Once, Wait Till Action Completed, Run Again?....
im bored and making a little movie that will eventually be...its not worth it. what im having trouble with is random movement. i want to get some random coords (Math.random() * width, Math.random() * height) and then tell my object to move a percentage of the distance to the location, causing an easing effect as the object gets closer to the destination. once the object gets there, i want a new random set of coordinates and i want the object to again travel a certain percentage of the dis to the target, and so on and so on. the percentage movement isnt my prob. my problem is keeping the MC from continually generating random numbers and never allowing it to reach its destination. heres what i have, i know what the prob is, im just at a loss for what to do about it.
onClipEvent(load) {
//center the MC
_x = 250
_y - 250
}
onClipEvent(enterFrame)
{
//i started to set up some variables (stopped and move)
//that would tell the MC
//when to generate a number but i decided to come ask
//instead...
stopped = true;
move = false;
speed = .2
if(stopped)
xtarget = Math.random() * 500
ytarget = Math.random() * 500
xdis = _x - xtarget;
ydis = _y - ytarget;
_x = _x - (xdis * speed)
_y = _y - (ydis * speed)
}
something taht tells the MC to get an x and y target once and then move would help... thanks a bunch
View Replies !
View Related
Making Flash Wait Between Code Statements
Hey guys!
Here's the picture:
I've got an iframe holding my flash. When I click on a button on the flash, a closing sequence ( a number of frames in the _root ) should be played before the iframe is replaced with an html page.
My code for the button would go something like this:
on (press) {
_root.gotoAndPlay("end_sequence");
getURL("newpage.html","frame");
}
Now, what happens is that, no sooner than my end squence begins... the new page gets loaded, hence the sequence is cut short. How can I tell flash to wait until all the frames in the end sequence have played before it should execute the getURL to bring in the new page?
Maybe you might suggest something like placing the getURL on the last frame of the end sequence. But since I have six buttons each calling a different page, I would have to include some code to check which button had been pressed before calling the correct page. Is this the only way... or is there a way to tell flash to wait between executing code statements?
View Replies !
View Related
How To Make One Movie Wait Till Another Is Loaded?
Hi,
I'm working on a flash site that has a different movie for each page. To add a transitioning effect, I'm trying to insert a fade clip into the navigation process so that when a link is clicked, the old content fades out and then new page fades in.
Rather than go in and edit 30 pages in the site, I'm making a single movie on the top layer that is simply a solid box the color of the background, and it fades in, making the old content appear to actually fade out.
So, when someone clicks a button, it calls a function that 1) runs the fader, 2) turns all the old content off, 3) turns the fader off, and 4) plays the appropriate movie.
my script w/out the fader is someting like this:
function clear_main () {
// play the fadeout here
setProperty ("/content_fade", _visible, true);
tellTarget ("/content_fade") {
gotoAndPlay (2);
}
// this is the part that's not working right ..
// i need to make it wait from right here within the function maybe with a while loop???
ifFrameLoaded("/content_fade", "done") {
//setProperty ("/content_fade", _visible, false);
}
// clear everything in the main content area
setProperty ("content_home", _visible, false);
setProperty ("content_about", _visible, false);
..... etc ......
} .. then when the function is done, the script on the button goes ahead and plays the next movie.
What I need a little help with here, is, how do I script it so that it will wait until the "fadeout" movie is finished, and then make the layer set to invisible, and then go and play the next movie?
I think it's something with the ifFramesLoaded function, but I'm having a tough time with it and would like to see how those of you who are more familiar with it would go about doing this.
Thanks a lot for any advice!
z33man
[Edited by z33man on 08-26-2002 at 05:39 AM]
View Replies !
View Related
Make A Sound Object Wait For 2 Seconds?
How do I make a sound object wait for 2 seconds before it starts???
Here's the go to create and play the sound:
nar = new Sound(nar_MC);
function playPage() {
nar.stop();
nar.attachSound("page 1");
narVolume = 400;
nar.setVolume(narVolume);
nar.start();
}
function mute() {
nar.stop();
nar.attachSound("page 1");
narMute = 0;
nar.setVolume(narMute);
nar.start();
}
if (playing != true) {
mute();
} else {
playPage();
}
stop();
View Replies !
View Related
Make A Flash Movie Wait Before Playing?
How can you make a flash movie wait for a little while then begin playing? I have two flash movies on my site that seem to distract me when they both play at the same time, so I wanted to make the first one wait for a period of time until the first one finishes. Is this possible? Any help would be greatly appreciated.
Thanks, Bill
View Replies !
View Related
How To Make Flash To Wait For User Input
Hi,
I found this PHP script, then I made some changes to make it FEED the Flash user interface with online user input.
The main concept of this script is WAITING for user input, so it shows the messages and then go to next line and so on.
The user input go to directly to TEXT file which writes in lines, each line has a unique id = (mag_id).
There "get_msge.php" which works as the middleware between FLASH and messages text file.
The problem, its doesn’t show any data while there are data in the text file.
Help here please, best regards.
This is the link of problem illustartion
AS is:
// create an object to store the variables
varReceiver = new LoadVars();
// load the variables from the text file
varReceiver.load("get_msg.php?file_id=1&msg_id=1", "POST");
// trigger something - when the variables finish loading
varReceiver.onLoad = function(){
//the variables have finished loading
if (this.msg_id == 1) {
_root.xmsg1_swf.text = this.msg;
_root.xmsg1_ch.text = this.msg;
gotoAndPlay("line2");
} else {WAIT }
}
PHP is:
<?php
//get these values from the FLASH
$file_id_swf = $_POST ['file_id'];
$file_name = "messages/messages".$file_id_swf.".txt";
$msg_id_swf = $_POST ['msg_id'];//_______________________________________________________
// [0] ."||".[1] ."||".[2] ."||". [3] ."||".[4]."||". [5].
//$msg_id."||".date."||".time."||".$from."||".$to."||".$msg.
$fp = fopen ($file_name, 'rb');
while (!feof ($fp))
{
$msg_txt = fgets ($fp, 1024);
$line = explode ("||", $msg_txt);
$msg_id = $line[0];
$from= $line[3];
$to= $line[4];
$msg = utf8_encode ($line[5]);
if ($msg_id == $msg_id_swf)
{
echo "msg_id=".$msg_id."&from=".$from."&to=".$to."&msg=".$msg;
}
}//while
fclose ($fp);
?>
Attach Code
// create an object to store the variables
varReceiver = new LoadVars();
// load the variables from the text file
varReceiver.load("get_msg.php?file_id=1&msg_id=1", "POST");
// trigger something - when the variables finish loading
varReceiver.onLoad = function(){
//the variables have finished loading
if (this.msg_id == 1) {
_root.xmsg1_swf.text = this.msg;
_root.xmsg1_ch.text = this.msg;
gotoAndPlay("line2");
} else {WAIT }
}
View Replies !
View Related
Can I Make A Function Wait For A Period Of Time?
Hey everyone
I just wanted some idea's on how best to tackle this problem in actionscript.
All I want is that when a button is pressed it fades out the current page and then fades in the new page to be displayed. How ever when trying to fade out the current page i doesn't because it goes to the label and starts to play but the next part of the script tells it to go straight to the label to load the new page. Does anyone have a clever way of making it wait till the current page is faded out?
If worse comes to worse can I just make it wait a set period of time before fading in the new page?
Ive attached a bit of the current code and comment it with where the current page is faded out.
Thanks in advance for any help
Gaunt
Attach Code
function homeClick(event:Event):void {
if(prevPage != "home")
{
if(prevPage == "advertising")
{
// Here is where the current page is told to fade out
MovieClip(this.parent).pages_mc.gotoAndPlay("advertisingEnd");
}
else if(prevPage == "websites")
{
// Here is where the current page is told to fade out
MovieClip(this.parent).pages_mc.gotoAndPlay("websitesEnd");
}
MovieClip(this.parent).pages_mc.gotoAndPlay("homeStart");
prevPage = "home";
}
}
View Replies !
View Related
How To Make Button Wait For 1st 28 Frames To Play
i have a movie with two sections. im trying to get it so that when a user presses a button to see the second section, it waits and checks to make sure the first section has completed before going to the 2nd section.
so basically right now this is the code i have on the button. it will only work if the MC is already at frame 28.. but if not it of course does nothing. I want the button to always make the movie go to the 2nd section, but only if the MC has played and stopped at frame 28. how would i go about having it *wait* for frame 28 to play when the button is clicked before going to the next section?
on(release) {
if (janiceMovie._currentframe == "28") {
janiceMovie.gotoAndPlay("wave");
}
}
View Replies !
View Related
How To Make Flash Wait For File Loading With AS?
I've got some Flash files that generate graphs. Right now they're manually updated but I'm working on an updated version that works off CSV files. I've already got the CSV parsing and graph generation down, but there's a problem loading the file. It needs a second or two to load the file, and I don't know how to dynamically make it wait to fully load the file before executing the parsing and graphing. Right now I just pushed the parsing and graphing 10 or so frames down the timeline, but I don't see why the whole file can't be only 1 or 2 frames. The original, manually-updated file is only 1 frame.
I also just realized that part of the delay might be parsing the data as well, not just loading (the file is only about 1kb). Is there some general code to have Flash wait or do I need code specifically to make Flash wait while loading and wait more while parsing?
View Replies !
View Related
Please Help With Virtual Keyboard -- How To Make Flash Wait For Input ...?
hi i've created a virtual keyboard for a project i'm working on.
i'm completely stumped on how to make flash 'wait' for input from the virtual keyboard.
for instance, the user will use the keyboard to modify existing nametags. the virtual keyboard is called and the nametag is passed to the function for editing, however, the script just keeps on running without waiting for the user to finish the editing.
how can i launch the virtual keyboard, allow the user to edit text with it, and then when the user is done flash can continue executing code (such as saving the edited nametag to a database) ...?
hope i'm being clear on this, not really sure how to state my need.
insights greatly appreciated.
View Replies !
View Related
[F8] How To Make Movie Wait Till The External Swf Is Loaded?
My question is in 2 parts:
1- I want to preload both -my main movie and an external movie, before it acually plays the main movie, how do i do that?
2- does my external swf get cashed this way? so if i used another main movie would it detect that i already cashed the external file before?
my preloader code is:
Code:
stop();
var total:Number;
var loaded:Number;
var percentage:Number;
this.onEnterFrame = function():Void {
loaded = this.getBytesLoaded();
total = this.getBytesTotal();
percentage = (!isNaN(loaded/total)) ? Math.ceil((loaded * 100)/total) : 0 ;
if(percentage > 100) percentage = 100;
this.loaderbar_mc._xscale = percentage;
this.loadertext_txt.text = ""+percentage+"%";
if((loaded == total) && (total>100)){
gotoAndPlay("init");
delete this.onEnterFrame;
}
};
thank you guys
View Replies !
View Related
Wait Script Or Wait On This Frame Required
hey,
i want my movie clip to stop and wait on a definied frame for a definied amount of seconds...
(...without adding the right number of "empty" frames after the key-frame...)
how can i script an easy funktion() to make my movie-clip wait for some seconds on a key-frame??
can somebody help me on this???
thanks
View Replies !
View Related
How To Make A "For" Loop Wait For Awhile?
Hi there
I'm trying to write a banner ticker that loads its swf file names from a text file. ticker should load the first swf and then waits and then does the same thing until the last file is shown in my text file. I wrote the code below and it works just fine. what I couldn't achive is making my "for loop" wait for a while before next swf is loaded. I think I have to use setInterval somehow but I ain't familiar with this function. Any ideas about how to do that? Thank you all in advance...
Code:
files = new Array();
lv = new LoadVars();
lv.onLoad = function(){
fl = this.filelist;
files = fl.split(",");
loadFile(targetMC);
};
lv.load("http://www.young.com.tr/files.txt");
function loadFile(targetMC){
path = "http://www.young.com.tr/banners/";
r = files.length
for (i=0; i<r; i++) {
loadMovie(path+files[i], targetMC);
unloadMovie(targetMC);
trace(files[i]);
}
}
View Replies !
View Related
Trying To Make A Button Rollover, Wait And Recheck Rollover
hi. i'm mostly comfortable with the graphical elements of using flash and there a gaps in my knowledge when i want to polish things up.
i have a bunch of buttons which, when rolled over, trigger some text to sweep accross in an area above the buttons and sweep away when rolled out.
this works nicely but if the viewer sweeps the mouse over a few buttons quickly all the MCs with text in play and it gets very messy.
the only way i can think to tidy this up is to make the button delay when rolled over and recheck about half a second later. if it's still rolled over then it plays the MC. i tried this the obvious way (triggering a small MC with onRollover > play MC at the end) but it needs the actual act of rolling over to trigger so i had to roll out and over again which defies the point >.<
i realise this is a really specific problem and it's very cheeky to ask others to solve my problems but if any of you have come accross similar problems and can point me in a better direction i'd really appreciate it.
View Replies !
View Related
How Can I Make This Code Better
heres my code
Code:
if (c[0]+c[1]+c[3]+c[4] + .... + c[40]==0){
do something
}
as u can see i figured out how to make an array ....... basically the code sums all the elements in the array.
Why??
On my map engine i have 40 pieces each having its own hittest with the main character. If hittest ==true on mc0 then c[0]=1. Therefore when there is no hittest the sum of all the arrays elements are Zero.
thanks
View Replies !
View Related
Can You Make This Code Better?
Hi all,
I created an Infinite menu item and after reading through the forums I applied a few tweaks to get the follow behaviors:
a) only rolls when the mouse is over the MC
b) has a deadzone of about 200 pixels in the center for easy clicking
One problem i am having is that it will stop scrolling if I leave the swf above or below it, however sometimes it continues scrolling if I leave by the left or right edge.
I am also curious if this could be simplified.
Code:
onClipEvent (load) {
xcenterhigh = 442;
xcenterlow = 250;
speed = 1/20;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (_root._xmouse>xcenterhigh) {
var distance = _root._xmouse-xcenterhigh;
} else if (_root._xmouse<xcenterlow) {
var distance = _root._xmouse-xcenterlow;
} else if (_root._xmouse>xcenterlow) {
if (_root._xmouse<xcenterhigh) {
var distance = 0;
}
}
_x += (distance*speed);
if (_x>0) {
_x = -692;
}
if (_x<-692) {
_x = 0;
}
} }
Thanks,
Eric
View Replies !
View Related
How Can I Make This Code Better?
How can I make this code better:
ActionScript Code:
onClipEvent(load)
{
speed = 10;
speedx = speedy = speed;
targetx = this._x;
targety = this._y;
}
onClipEvent(enterFrame)
{
_x += (targetx - _x)/speedx;
_y += (targety - _y)/speedy;
}
I use the code to move object by changing targetx and targety with the click of a button.
The animation at the end seems to be 'jagged' - i.e. it kind of 'judders'.
How do I stop this?
Are there any better alternatives to the above?
AND... if possible, I'd like to do it in Flash 5. (But if there are better ways to do in MX, please let me know this as well.)
Thanks.
OM
View Replies !
View Related
|