ActionScript 2.0 :: Call Loop MC From Different Position?
Jun 9, 2010how to call loop Mc from different position mean some from left some from right some from up and some from down
i used duplicate movie clip and all mc in loop
how to call loop Mc from different position mean some from left some from right some from up and some from down
i used duplicate movie clip and all mc in loop
If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?
View 2 RepliesI have 4 objects that I all want to have their own velocities. I have a bunch of variables (each one has a different value):
PHP Code:
public var vx1:Number;public var vx2:Number;public var vx3:Number;public var vx4:Number;
Rather than having a function for each object to say:
PHP Code:
function1 { this.x = vx1}function2 { this.x = vx2}function3 { this.x = vx3}function4 { this.x = vx4}
I'd like to have a for loop to have my objects x position to += vx(1 through 4):
PHP Code:
for (var i:Number=0; i<5; i++) {
this.x += (vx+[i]);
}
So I tried the above with a combination of " " around different parts of (vx+[i]) but I realized that turning any of it into a string means 'this.x' cannot read it because x has to be a number not a string. So how can I make this.x = vx1 then vx2 and so on with a for loop?
I have this tween function that moves an object 100 pixels as soon as it enters the frame.
if (currentValue % 15 == 1) {
var rab1:MovieClip = rabbit1._x;
var myHoriTween:Tween = new Tween (rabbit1,"_x",Regular.easeInOut,rab1,(rabbit1._x = rabbit1._x + 100),2,true);
myHoriTween.onMotionFinished = function (){
this.stop()
}
My idea is to set up a loop to watch the tween, once it advances its 100 pixels from where it started I want to do a few things before I go to the next frame. Right now I'm using a timer, but it limits my ability to control the playhead.
I've been trying to create a loop to check the current _x and trace it so I can see it advancing as its tweening but it's simply too advanced for me.
i have a loop as follows and the positioning is doing nothing, they are all just standing in one place one on top of the other.
Code:
this.createEmptyMovieClip("thumbHolder_mc", this.getNextHighestDepth());
for (var i:Number = 0; i < 20; i++) {
var thumbnail = "thumb" + i + "_mc";
[Code]....
got some code working to duplicate a movieclip, but what I'd really like to do is obviously randomise the movieclip's x position so that it spreads across the stage, rather than stacking in the same position as it is now.
Code:
for (i=1; i<11; i++){
duplicateMovieClip("alien", "alien_new_"+i, 22-10, i);
}
I'd like to have my movie clips on the stage and run a loop to return their x and y positions, these positions will be stored in an array (startPos:Array) for use later in some other script. I have 7 movieclips on the stage, each with an instance name startobj[a number]
AS2.. Nice all works:
var numberOfElements:Number = 7;
var startPos:Array = new Array();
for (var i:Number = 0; i<numberOfElements; i++) {
var startObjs = eval("startobj"+[i]);
[Code] .....
But when I trace all I get is 0,0,0,0. Is this something to do with in AS3 there is no connection between names and things?
i have a loop as follows and the positioning is doing nothing, they are all just standing in one place one on top of the other.
[Code]...
I have a bunch of buttons "b1" - "b12" which are set up in a "for" statement. Then on a rollover of each button, I want a popup to appear which I have created called "b(#)popup". The way I have it set up, when I trace the variable "popup" I get "b(#)popup" like I want, but it is not causing the popup to appear.[code]...
View 2 RepliesI'm trying to make a dynamic image gallery from and xml. From my tutorials, right now i've got it so it will constantly add the next thumbnail below the other, which is fine, but I'm trying to figure out how to make it that once it reaches a certain y coordinate, it will move the x coordinate over and stack them again. So that rather one long list of thumbs, it will be a side by side stack. For some reason, I can't get it in my head how something like this would work. My goal is to have a side by side stack that I will end up putting in a movie clip that will be masked to show only 2 stacks at a time. Then when clicking a button will slide it over. I was planning to use the "movieclip.length" to calculate how far over to move it, but i haven't gotten that far yet. This is what I got:
[Code]....
here's my code:
ActionScript Code:
for (var i:int = 1; i < 10; i++) {
var symbols = new targetTester();
[code]......
Is it possible to have a function call within a for loop?
Code:
for(i=0;i<someDynamicVar-1;i++){
_root["button"+i].onRollOver = function() {
trace(i);
trace(imageList[i]);
}
Also is it possible to give a movieclip that has an image loaded into it, button functions?
I have a function:
[Code]...
This function creates a word inside of a movieclip. The words that it makes are specified in a text document in an array, and I don't know how many there will be. Then I have a do while loop that creates movie clips for these words to go into:
[Code]...
I have a thumbnail gallery and i want each thumbnail to appear 1 by 1 rather than appear all at once.At the moment i have a for loop that creates each of the thumbnails.
[Code]...
My nested loop works fine, but I don't know how to call out a node or set of nodes in my code. Here is what I have
knobCC = [];
knobCCC = [];
var hardware = this.firstChild.childNodes;
[code]......
I want to loop through a array to call my functions, but can't get the syntax right, is this possible?
var myArray:Array = ['function1()', 'function2()'];
for (var key:String in myArray){
// I want to call the function here
}
I'm trying to dynamically stack images that are being pulled in via an xml file. Below is what I'm doing, and it almost works. The problem is that it only seems to fire off the event complete function on the very last one, instead of going for all of them. Is there a way to make it run the even.complete function for each image?
function aboutfileLoaded(event:Event):void {
aboutXML = new XML(aboutTextLoader.data);
for(var l:int = 0; l < aboutXML.aboutimages.image.length(); l++)
[Code]....
I have 35 textboxes with the names "t1" to "t35". How would I call these names in a for loop? I have tried this with no luck:
[Code]...
I know I'm doing something wrong with the ("t"+i) but I dont know how how to combine a string and number like that.
I have a swf within a html page. There is a function that opens an html page when an object gets to a certain x position. However, when the object gets to that point the new html page (in _self) opens over and over again and get stuck in a loop. Any way to escape this loop and what would be the best way to trigger this new html page to open when the x position of the object is true?
View 1 RepliesI am trying to figure out how to call an onComplete function without leaving the code loop (because the vars are no longer recognized with the hand-off). I thought this might work:
[Code]...
I have a for loop which duplicates movieclips. To call/create the new clips, I use this:
[Code]....
I just finished a simple music player... For testing purposes. I upload it in the following address:http:[url]....with 10 music songs that I had recorded from radio stations(added the last 2 twice for testing).The problem is that when a song has totally loaded, stop action taken needs about 1 second to be applied!I.e. When I press "STOP", the sound continue to play for 1 sec before stop. When I push "pause" it takes one second for the music to stop!
However when using resume (second time pause) the sound starts instantly! Thus I guess there is an issue with stop()function of the SoundChannel object that I am using to stop the sound. Also notice that when unpause the music, it continue ~one second before the last sound - which means that I saved the soundChannel.position number (and also call soundChannel.stop()) in correct time, but it didn't stop immediately - bug!?
This only happens when the application runs through a browser(plugin v. 10) - programmed in CS3.
PS1. Notice that ,this also happens when I change Volume too. Thus because Stop and Volume are parts of SoundChannel, I guess there might be a bug with SoundChannel in online plugins..... :/
PS2. Notice that ,this also happens when I close the browser (firefox). Even if browser is closed the music continue for 1 sec the same way as when pressing stop!.. Thus I guess it's flash bug!...
i have some actionscript that makes a
ExternalInterface.call('someFunction');
call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?
Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.
Currently:
Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);
[code]....
I added a Menu_mc on my stage. Initially, this should be at the center of the stage and when I click on it, it will tween on the upper left corner of the browser. However, when I resize the browser, the Menu_mc goes back to the center of the screen.
I have tried separating a different actionscript file where it is specifically for initialization of the object and another one for resizing. And then when I call it on my main AS file it goes like this:
Code:
// Add the symbols to stage
var Menu_mc = new Menu_MC();
addChild(Menu_mc);
[code]...
But it seems futile.
I am using a ScrollPane in my application(viz., instance name is: myScrollPane). When I view the contents of the ScrollPane, it shows them perfectly. My issue is: When I try to view data present inside the ScrollPane, if I move the Vertical-ScrollBar of the ScrollPane to middle(or somewhere from top to down) and then click on Submit button(viz., instance name is: submit_btn), then its Vertical ScrollPosition must be reset from middle(or any position where we leave it before) to top(or initial position). Hence, I need to move the Vertical ScrollPosition of ScrollPane to top (or) initial position. Everytime, I need to refresh the VerticalScrollBar Position when I click on the submit button. How to do it?
View 1 Replieshow to make an actionscript to move punto_mc from current position to random position after release, and then from this new position to mevo to another randon position after release?
View 2 RepliesI have simple image gallery, where images are placed one next to another and the mask is revealing only one of them. Now I want to tween position of the images, but when I do that the mask is "traveling" alongside with the images..
View 4 RepliesSo I'm trying my hands on some full browser flash and after reading a couple of tuts I wrote this
Code:
#include "mc_tween2.as"
Stage.scaleMode = "noScale";
stageListener = new Object();[code]...
The trace's are because it didn't work like I thought it would.Etc the middle movieclip didn't center itself but rather positioned itself seemingly how it pleased so I traced its x position and the var stageXcenter position and like suspected it shows different values.
i want to take btn1 position half wwidth of own x position on stage
View 1 RepliesI have a ScrollPane and I want to get and set the scroll bars position (pixel position). For example, if the user changes the scroll bars position and then refreshes the page, we need to take the user at the same point where he was before refresh. For this I need to get the respective scroll bars positions before refresh and then set it to the saved position after load. I have got the positions by hPostion and vPosition but now when I try to save the values back to the same properties after refresh it doent work.
View 2 Replies