ActionScript 2.0 :: Dynamically Clear A Triggered SetInterval By A Parameter?
Jun 15, 2009I've been trying to dynamically clear a triggered setInterval by a parameter, but have had no luck. Here's an example:
[Code]...
I've been trying to dynamically clear a triggered setInterval by a parameter, but have had no luck. Here's an example:
[Code]...
I have a file where user chooses xy cordinates which display in text box.... which is workin, but I want to have it only appear inside a box area? ie choose once only inside box area - once outside i want the mouse to behave as normal (no new pointer no xy tracking) not sure what if statement would work ?
onClipEvent (mouseDown) {
duplicateMovieClip("../cue", "cue" add n, n);
setProperty("../cue" add n, _x, getProperty("_level0",_xmouse));
[Code]....
I have an external swf that plays an intro in multiple frames of various actionscript fade ins and fade outs. I use a setInterval command on frames that I want to stay up for a period of time:
[Code]...
I'm making a project where slices of faces are randomized at different times. Each MovieClip contains 24 frames.
Here's what I have:
Code:
#include "mc_tween2.as"
stop();
//Total number of faces.
[code]....
The code below works but NOT properly. After few minutes, the flash animation slows down and also any other program that is running in the computer. I suspect that these routines flood the memory ( probably the stack memory because it uses recursion ) which then starts using slow virtual memory. There are two recursive processes initiated by two Timer types (Timer_1 and Timer_2 ) of addEventListener(). The functions that they call use a lot of.draw(0 and .clone() methods to manipulate memory-demanding bitmaps.For clarity sake I removed the lesser relevant part of the code.How to dynamically clean memory inside these routines and avoid them flooding computer's RAM memory?[code]
View 1 RepliesI have a function gameTimerInterval() set to run every half second. Every x of those intervals (the value of x varies in this situation), it creates another interval that calls the function birdTimerInterval() every y of these new intervals. Basically, gameTimerInterval() determines when a new flock of birds will enter, and then birdTimerInterval() controls how each individual bird in the flock comes in (one at a time). The thing is, there can be multiple flocks coming on the stage at the same time, so birdTimerInterval() will need to receive a parameter so it knows which group of birds to control. The only way I could see achieving this is doing something like dynamically passing the name of the interval that's calling the function, as I don't know how I could use global variables or arrays to distinguish which flock should be moving.
View 4 RepliesI am generating movieClips dynamically using attachMovie and then using a setInterval to animate them. However, if I repeat the operation the second set of mcs move twice as fast, the third set three times as fast etc. I can't for the life of me work out why.
[Code]....
I have a rquirement where i want to play the song based on the checkbox checked.I mean i want to set the flashvars parameter of swf object on click of checkbox to play respective song.I am using the tag for this is
[Code]..
in my website. Here i want to change the flasvars dynamically on checkbox(function as radion button) checked
basically, this is a menu with a scrollPane and clips inside for each line.I have to colorise the line if it is the current line.here is the code :
ActionScript Code:
// this gives l1, l2, l3 ect... no pb with that
var lineToColorise = 'l'+ArtAPI.GetCurrentSlide();
// here is the pb
eval('container.scrollPane.content.'+lineToColorise).setColor('mycolor');
the thing is, when I write
eval('container.scrollPane.content.l10').setColor( 'mycolor') for example
instead of lineToColorise it works.
So i have a problem using the dynamic value ... but why ?
I'm working on a game whose background has many layers that each scroll at different speeds.
Inside each layer I have a Sprite, I've started using graphics.beginBitmapFill, but what I've found is that the graphics.clear() function doesn't actually clear the contents set by the previous call to graphics.begin.BitmapFill. Each frame, I adjust the matrix to shift the layer as needed. Then, I call graphics.clear() and graphics.beginBitmapFill() with the adjusted matrix. Since my layers have alphas in the bitmap, I can see the contents that was drawn the previous frame.
im looking for how to remove a setInterval. i searched but the answer which was supposed to work dident for me.
[Code]...
Can we skip an optional parameter and assign value to the parameter after the skipped one?
For example I have a function:
public function Dialog(message:String,title:String="Note",dialogsize:int=99):void
{
}
I can easily call the function with a message and a title:
Dialog("HELLO","Intro");
Is there a way to skip the title and just pass in the dialogsize? I've tried it but can't make it work:
Dialog("HELLO",,dialogsize);
Is it possible to skip some optional parameters without using (rest) parameter?
[Code]...
doesnt clear the line when mc1 moved ? How solve tihs problem?
I am trying to read a XML file and check a parameter for duplicates of that parameter in the file. There could be up to 200 entries with this parameter which is a number. How can I check to see if there are any duplicates?
View 2 RepliesForgive me for this stupid noob question but I want to call a function (loadList) that originally gets triggered after a mouseevent from another function (addToXML) that does not have an event.
The loadList function takes info from a XML var, sticks it into an array which then gets loaded into a tile list and that is working fine.
The addToXML function when called adds elements to the XML var after which I want to call the first function with the event parameter so it refreshes the items in the tile list.
I know it can do this by creating a new array and loading that into the tile list in the addToXML function, but it be much simpler to just recall the function.
I have tried things like
Code:
addToXML.addEventListener(Event.COMPLETE, loadList);
but all the event constants I have tried give me error messges like "1061: Call to a possibly undefined method addEventListener through a reference with static type Function."
I'm a Flash newbie and I'm trying to get some keyboard action going. I've followed some tutorials, but nothing seems to work. To test it I created a brand new fla file and added the following code in the first frame:
[Code]...
The first trace ("Add listener") shows up in the debug output, but no matter which keys I press I can't get the function to be called. Am I doing it wrong?
NetStatusEvent has only one type of event: NetStatusEvent.NET_STATUS; but it comes with many codes for various cases.
Here they are, listed.
However, a lot of them are not triggered for me. I know some are FMS specific but I'm talking about "NetStream.Play.Stop", "NetStream.Pause.Notify" or "NetStream.Unpause.Notify".
Is there a case when they shouldn't be triggered, even though I'm calling NetStream's control functions (which take effect), or a known issue around this matter?
I am making component with text field in it and I want to call some function on the onChanged event that trigger another function.
In case I define onChanged event on the following way everything is ok my_TextField.onChanged = function ()
{.....} but if I use listenerObject, function inside another function is not triggered.
[Code]...
my completeHandlerI would like it to be triggered when the progress bar is complete.
// uploader script
var URLrequest:URLRequest = new URLRequest("http://mysite.php");
// image types
[code].....
I am trying to extract the last part (after the last .) of what trace(evtObj.target) shows, but when i try to use the code bellow to do it i get some of the info i get for the traces EventOb=_level0.RightSide.instance435.Ath (or whatever it is that triggered the event) Legth=Undefined
i get Undefined for all the string commands i have tied
example for evtObj.target with
_level0.RightSide.instance435.Ath
i want to get just Ath
[Code]....
I have a project that has 6 movie clips across the stage that are triggered by mouse click. The trouble I'm having is getting them each to dissapear when the next movie clip is triggered. You can click out w/ an "x" box but I want them to dissapear when the next mc is triggered also.
Code:
var mc:handfade;
hand_mc.addEventListener(MouseEvent.CLICK, handPage);
function handPage(e:MouseEvent):void
[Code]....
I created a simple animation that needs to have a button on one segment of the animation. I created a button with a action of getURL in AS3, the problem I am having is that every time the animation loops from the first frame it triggers the button and the new page I requested pops up.
View 6 RepliesI'm looking for an event that tells me when the browser is refreshed, or better to say, when my flash app exits. So I tried
stage.addEventListener(Event.DEACTIVATE, onDeactivate);
but its only triggered when closing the debug window and not on refreshing or closing the browser.
I created a button that looks up the coordinates of the device. There is no errors in the code but for some reason which is eluding me, the event is not being triggered.
Here is my code:
protected function lblCheckIn_clickHandler(event:MouseEvent):void
{
if (Geolocation.isSupported)
[Code]....
I made this simple movieclip with over and out states. However my function does not work. When moving over the movieclip the mouse out event is called immediately. I don't know why this is happening.
ActionScript Code:
home.buttonMode = true;
function onOver (e:MouseEvent):void {
[Code].....
What I am wanting to do is move multiple MCs when a MC (acting as a button) is released, the following is the code that i have tried but it doesn't want to work:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;[code]...........
I'm a beginner in AS and is trying to build my website entirely on AS2.0. Here's an effect ( I call it "appear effect" ) I wanna create with the tween class:
[Code]...
I would like to have this effect triggered whenever a button needs to appear. In total, I have about 10 btns. I believe I have to store it inside a function. Tat's all I know, can someone pls kindly guide me thru this?
Im going to repost this question but simplify it, I read this post afterwards and it even confused me... have 3 movie clips that are being used like a button, they appear in the middle of the screen, when clicked on the 3 movies move to the left of the screen.the top movie clip is at x: 30 y: 180the middle movie clip is at x: 30 y:345the bottom clip is at x: 30 y: 510if you click on the middle clip, it moves to the postion of the top clip,the top click then movies to the bottom, and the bottom moves to the middleif you click on the bottom clip, it moves to the top, the middle clip moves to the bottom, and the top clip moves to the middle.basicly the 3 clips cycle positions, depending on what clip the user clicks on, the button that was clicked on moves to the top.THE PROBLEM....I want to load an external movie clip. I want the clip to load when the the movie clip that the user cliced on moves to the top postion x: 30 y: 180,
THE CODE.....
//************************************************** **********************
//************************************************** **********************
[code].....
I have a scrolling navigation bar and two buttons on either side to move it left and right. I created functions to handle moving the navigation MC left and right, and they work just fine.
My problem is, I'm trying to set my buttons up using onPress, like this:
function ScrollForward()
{
// function contents
}
[Code]....
The problem is, when I create the .swf, the functions placed in the onPress events automatically run. And neither button triggers the "onPress" events. I have removed the last two lines with the onPress events and the functions do not run, so the way I've set them up is obviously wrong.
The problem is obviously the onPress lines because the functions do not run without those lines, and if I simply put the full function within the onPress event rather than separate, they both run correctly. I want to call these functions elsewhere, so I don't want to simply include them solely within the onPress event.
I have created different buttons on different movieclip. Then i assigned onPress event on each buttons. But the function of onPress event is not triggered. The arrangement of movieclips is following.
var mainMC:MovieClip = _root.createEmptyMovieClip("mainMC",0);
mainMC._alpha = 0;
var adImgMC:MovieClip = mainMC.createEmptyMovieClip("adImgMC",0);
var offerMC:MovieClip = mainMC.createEmptyMovieClip("offerMC",1);
var offerList:MovieClip = offerMC.createEmptyMovieClip("offerList",0);
[Code] .....
I have created an event as follows:
offerList.onRollOver = function(){
offerList.stopTween();
clearInterval(autoScrlTimer);
} offerList.onRollOut = function(){
duration = 0;
autoScrlTimer = setInterval(automaticScroll,duration);
ovrFlag = true
}
I doubt that the onPress event is not working because of the above piece of code.