SIMPLE LOOP-D-LOOP
I have a tween that is 20 frames long nested in a MC.
Is there a way to set it to loop a specific amount of times and then stop? Similiar to the sound loop option?
Does someone have a little code or something to point me in the right direction?
Thanks!
FlashKit > Flash Help > Flash ActionScript
Posted on: 08-21-2001, 08:27 AM
View Complete Forum Thread with Replies
Sponsored Links:
LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
Ok so I have a simply for loop: ID[i] is a global array
Code:
for (i=0;i<12;i++)
{
var loadInfo:LoadVars = new LoadVars();
loadInfo.onLoad=function(success:Boolean)
{
if (success)
{
trace("whatever:"+loadInfo.myname);
}
else
{
trace("Nope");
}
loadInfo.load(ID[i]+".txt");
}
the problem I'm having is that the function doesn't execute until the for loop completes and then it executes 12 times in a row. Output is 'whatever: undefined' 11 times and then 'whatever: Bobble' (which corresponeds to the last .myname value as it should). Why is this? And how can I fix it? To be continued...
~NH
View Replies !
View Related
Loop Inside Loop... Why Doesn't Work Properly?
In order to cause a delay, I have put a loop inside another loop. Here it is:
for (a=1; a<6; a++) {
for (b=1; b<10000; b++) {
}
}
Flash delays to show the page but in the end I just see both variables with the maximun value. The point was to see variable "a" growing with delay. What have I done wrong?
Thank you
View Replies !
View Related
Function Inside For Loop; How To Give It Parameters Of The Loop
Hey!
This is the code:
Code:
for (i=0; i<5; i++) {
_root.createEmptyMovieClip("temp"+i, 1+i);
_root["temp"+i].beginFill(0xFF0000, 20 + (20*i));
_root["temp"+i].moveTo(0+(60*i), 0+(67*i));
_root["temp"+i].lineTo(100+(60*i), 0+(61*i));
_root["temp"+i].lineTo(100+(64*i), 100+(65*i));
_root["temp"+i].lineTo(0+(55*i), 100+(80*i));
_root["temp"+i].endFill();
_root["temp"+i].onRelease = function() {
trace("button Number = " +i);
}
}
So I made butttons and assigned each one an onRelease function. But each one needs to have assigned a variabile by the value "i" in the for loop.
When I write it like this the function itself is defined only after I click it and it ofcourse asigns all the buttons the same "i", the last value of "i" in the for loop.
How do I do it so I get first button with variable 1, second with 2,... ?
Thx.
View Replies !
View Related
Loop Help: XML Attribute Doesnt Stay On Each Object Of The Loop
Hi, i'm working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.
I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don't understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces "undefined" into the output box.
I have put
Code:
trace(images_arr[i].attributes.fullsize);
just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.
Can someone help me get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.
Thank you so much in advance!
Code:
function GenerateThumbs() {
images_arr = images_xml.firstChild.childNodes;
gap = 10;
this.createEmptyMovieClip("thumb_mc",100000);
thumb_mc._y = 10;
thumb_mc._x = 10;
for (var i = 0; i<images_arr.length; i++) {
trace('generating thumbs'+i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc", i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc", 300);
this.thumb_mc["thumb"+i+"_mc"]._x = ((i%3)*(67+gap));
this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/3)*(67+gap);
this.thumb_mc["thumb"+i+"_mc"].loadMovie(images_arr[i].attributes.thumb);
this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
var _mc = this._parent["thumb"+this.no+"_mc"];
var l = _mc.getBytesLoaded();
var t = _mc.getBytesTotal();
if ((l>=t) && (t>1) && (_mc._width>1)) {
_mc.onRelease = function() {
trace(images_arr[i].attributes.fullsize);
};
}
};
}
}
var images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (success) {
GenerateThumbs();
} else {
trace("Error loading XML file");
}
};
images_xml.load("gallery.xml");
View Replies !
View Related
Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class)
Though i'm wondering if there's an easier way than timers to be able to do something like that, like C's sleep() function for example.
View Replies !
View Related
My Sound Loop Is Repeating Itself Ontop Of Previous Loop
Here is a link to a movie that I am working on:
LINK-
http://blue-title.com/v2/
My client says that when you first start the movie, the loop starts fine but when he clicks on one of the three buttons at the bottom (Home, Florida, Alabama) the initial first loop continues to play and a new loop is beginning to repeat while the first one is still playing.
It works fine for me in Firefox and Safari on a Mac.
Any solutions?
Todd Temple
View Replies !
View Related
Simple Loop
Hi there,
well, I'am new in actionscripting and now I try to get started...
But now I've got a little problem...(I know, the solution will be
quiet easy.
I was trying to creat a little loop in actionscript, which allows me to give a variable every time it is recalled a bigger worth. (e.g +1)
How should such a movie look like?
Hope somebody can help me
Thanks
Daniel,
Germany
View Replies !
View Related
Simple Loop - DOH
hi guys,
could you please help me with a crazily simple probelm that I cant seem to figure out!!!
okay, i have all these items that I have to collect... dot0, dot1, dot2, dot3 etc. What I need to do is to set up a loop. here is what I have done so far ,but what am I missing???
Code:
for (i=0; i<dots; i++) {
if (_root.dot[i].hitTest(this)) {
_root.dot[i].gotoAndStop(2);
trace ("aaahhhh finally!!!");
}
}
btw: dots = 8
thanks guys!!!
View Replies !
View Related
Simple Loop
OK- I have a simple loop running off of my main timeline. On a certain fram, I would like this movie to stop.
How can I write this? Any help is much appreciated.
Thanks!
View Replies !
View Related
Simple Loop?
I have a intro that I have a goto and play 1 on frame 50 I want it to loop about 4-5 times and then after the 4 or 5 run it does a geturl command. What lines do I add to achive this loop effect?
View Replies !
View Related
Simple For Loop Please Help
Here is my loop with syntax errors
PHP Code:
for(i=1; i<5; i++)
{["Bn" + i ]onRollOver=function(){ gotoAndStop("_over");
}
["Bn" + i ]onPress=function(){gotoAndPlay("_down");
}
["Bn" + i ]onRelease=function(){gotoAndstop("_down");
}
["Bn" + i ]onRollOut=function(){gotoAndStop("_up");
}
["Bn" + i ]hitArea =["hit" + i ]_mc;
["hit" + i ]_mc._visible = false;
};
I've been fiddling with the code but I feel like I'm just hacking away. I've read through all my Flash books, 5 in total, and I still can't figure it out.
This should be basic programming correct?
thanks for the help.
View Replies !
View Related
Help With Simple For Loop
Hi there. i am making a simple photo gallery where when a button is clicked (in this example the button is 'custom'), then a function is called with the variables type and num. it will then make a menu based on type (the folder to open the pics from) and num (the number of pics in that folder). it is easy to understand i think. the problem is that the for loop doesnt work. i have a trace in there that never gets 'traced. can anyone help me with this?
thanks,
chris
Code:
custom.onPress = function() {
openpics("custom", 5);
};
//stop movement
stop();
//define the function - type of pic defines the folder that you
//want to open the pictures of, and num says how many pics are in that
//folder. the pics are numbered "1.jpg","2.jpg"... so they can
//be loaded easily with a for loop from the links created
function openpics(type, num) {
//create 'clickable' numbers to display each pic
for (var i = 1; i>num; i++) {
i = 1;
this.createEmptyMovieClip("number_"+i, i);
number_i._x = 15*i;
number_i._y = 10;
trace(i+" "+number_i+" "+type+" "+num);
number_i.createTextField("text_"+i, i, 0, 0);
text_i.font = "Arial";
text_i.size = 10;
text_i.color = 0xFFFFFF;
//change text color and style of number onmouseover
number_i.onRollOver = function(){
text_i.color = 0x999999;
text_i.underline = true;
}
number_i.onRollOut = function(){
text_i.color = 0xFFFFFF;
text_i.underline = false;
}
//add the number to the textfield
text_i.text = "["+i+"]";
//on click of each number/button, display corresp. pic
number_i.onPress = function(i) {
delete pic_holder;
this.createEmptyMovieClip("pic_holder", num+1);
pic_holder.scaleContent = true;
pic_holder._x = 15;
pic_holder._width = 285;
pic_holder._y = 20;
pic_holder.loadMovie("/images/"+type+"/"+i);
};
}
delete i;
}
View Replies !
View Related
Simple Loop
I was creating a loop to handle parsing this XML file and it doesn't seem to be working. This is probably some logic problem so I didn't look for resources. This loop begins at 1 because node 0 is used for something else. Help me understand where I may have goofed.Thanks for the help in advance.
code:
for(i=1; i<this.firstChild.childNodes.length; i++){
var song:String = this.firstChild.childNodes[i].firstChild.nodeValue;
var textBox = "text" + i + "_txt.text";
textBox = song;
}
View Replies !
View Related
Help With Simple Loop
Hi to all
I am Newbie and just into the ActionScript and coding to.. I just need a help with the loop... so far i can do the following..
on (release)
{
for(i=0;i<10;i++)
{
output=output + "some text";
}
}
thats works fine..but my question is how can i print the numbers i.e 123456789 in the text box using the loop?
Would appreciate any help on this.
Regards
Aneeliyo
View Replies !
View Related
Do While Loop ?... Should Be Simple....
for some reason, the following do while loop isn't scrolling continuously while the respective buttons are held down... take a look:
Code:
d_btn.onPress = function() {
scrollcheck = 0;
do {
myText.scroll += 1;
d_btn.onRelease = function() {
scrollcheck = 1;
};
} while (scrollcheck=0);
};
u_btn.onPress = function() {
scrollcheck = 0;
do {
myText.scroll -= 1;
u_btn.onRelease = function() {
scrollcheck = 1;
};
} while (scrollcheck=0);
};
there must be some simple logical error. any help would be greatly appreciated. thanks in advance!
View Replies !
View Related
Simple For Loop >>pls Help
Hola everyone, I'm kind'a new here so pls take it easy on me... heh
In any event, can anyone help me consolidate this portion of an actionscript l'm working on. I just can't seem to get this to work in a for loop, each of them is the same...
30 if statements in all each of them preforms the same task, just with a different value for the target movie clip (mark[i])... can anyone help me write up a quick for loop to make this code much smaller, and easily managed?
Thanks to anyone that can help me out w/this
Samantha G.
Code:
onClipEvent (enterFrame) {
if ((_root.mark1.hitTest(_root._xmouse, _root._ymouse, true)) and (draw) and (!mark1)) {
mark1 = true;
_root.marks++;
}
if (_root.mark2.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark2)) {
mark2 = true;
_root.marks++;
}
if (_root.mark3.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark3)) {
mark3 = true;
_root.marks++;
}
if (_root.mark4.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark4)) {
mark4 = true;
_root.marks++;
}
if (_root.mark5.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark5)) {
mark5 = true;
_root.marks++;
}
if (_root.mark6.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark6)) {
mark6 = true;
_root.marks++;
}
if (_root.mark7.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark7)) {
mark7 = true;
_root.marks++;
}
if (_root.mark8.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark8)) {
mark8 = true;
_root.marks++;
}
if (_root.mark9.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark9)) {
mark9 = true;
_root.marks++;
}
if (_root.mark10.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark10)) {
mark10 = true;
_root.marks++;
}
if (_root.mark11.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark11)) {
mark11 = true;
_root.marks++;
}
if (_root.mark12.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark12)) {
mark12 = true;
_root.marks++;
}
if (_root.mark13.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark13)) {
mark13 = true;
_root.marks++;
}
if (_root.mark14.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark14)) {
mark14 = true;
_root.marks++;
}
if (_root.mark15.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark15)) {
mark15 = true;
_root.marks++;
}
if (_root.mark16.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark16)) {
mark16 = true;
_root.marks++;
}
if (_root.mark17.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark17)) {
mark17 = true;
_root.marks++;
}
if (_root.mark18.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark18)) {
mark18 = true;
_root.marks++;
}
if (_root.mark19.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark19)) {
mark19 = true;
_root.marks++;
}
if (_root.mark20.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark20)) {
mark20 = true;
_root.marks++;
}
if (_root.mark21.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark21)) {
mark21 = true;
_root.marks++;
}
if (_root.mark22.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark22)) {
mark22 = true;
_root.marks++;
}
if (_root.mark23.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark23)) {
mark23 = true;
_root.marks++;
}
if (_root.mark24.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark24)) {
mark24 = true;
_root.marks++;
}
if (_root.mark25.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark25)) {
mark25 = true;
_root.marks++;
}
if (_root.mark26.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark26)) {
mark26 = true;
_root.marks++;
}
if (_root.mark27.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark27)) {
mark27 = true;
_root.marks++;
}
if (_root.mark28.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark28)) {
mark28 = true;
_root.marks++;
}
if (_root.mark29.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark29)) {
mark29 = true;
_root.marks++;
}
if (_root.mark30.hitTest(_root._xmouse, _root._ymouse, true) and (draw) and (!mark30)) {
mark30 = true;
_root.marks++;
}
}
View Replies !
View Related
Simple For Loop Help
I've been experimenting with a simple imageViewer class, implemented like this:
var viewer1:thumbLoader = new thumbLoader(target_mc);
viewer1.loadImage("whatever.jpg");
my question is how would i use a for loop to make twenty viewers (1-20) load say, twenty elements from an array. One problem is that if I use a string like ["viewer" + i], the class file is expecting a movieclip and throws up a type mismatch. I would guess it's done something like this:
for (var i=0; i<20; i++) {
var this["viewer"+i]:Thumbloader = new thumbLoader("target_mc"+i);
}
but obviously this doesn't work. any help much appreciated.
View Replies !
View Related
(simple?) Sound Loop
ok well i guess to understand this you might need to see my site(or might not?) http://www.fospher.com
my problem is when my sound pauses - it doesnt really pause - its just that u cant hear it - and it keeps going. i need the sound paused though. here's the code i used to start up the sound:
s = new Sound();
s.attachSound("cky");
i = 1;
function timeme () {
now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
_root["nowtime"+i] = (Number(hours)*3600)+(Number(minutes)*60)+seconds;
_root.newstarttime = _root["nowtime"+i]-_root.nowtime1;
i++;
}
s.start(0, 99);
timeme();
the code i use the pause the sound:
on (release) {
s.stop();
timeme();
}
and the code i use to start up the sound again:
on (press) {
s.stop();
s.start(_root.newstarttime);
}
so - once again if you know how to actually PAUSE this code please help!!!
View Replies !
View Related
Simple Loop For Question
Code:
// DUPLICAETS MC
for (Count=0; Count<(diasdelmes+1); Count++) {
_root.DiaDelMes.duplicateMovieClip("coso"+Count,Count,Count);
trace("I DUPLICATED THE MC");
set(eval(("coso"add Count)._x), 50*Count);
trace("I PUT IT IN PLACE");
}
this is a simple for loop that duplciates a MC and then it places al the Mcs 50 pixels apart from each other...problem is, it does duplicate them but it places them all in the same location (on top of each other) i know that the part where i set the ._X for the Mcs is somehow wrong...how is the right way for it to work?
i tried without the eval but same result...
View Replies !
View Related
Simple Loop Glitch
I'm sure this is easy, but why won't this loop work?
Code:
for (i=1; i <= 4; i++) {
_parent.band_mc.[btn+i].gotoAndPlay("cycle");
}
It has something to do with the string concatenation, but I'm not sure what the correct syntax should be.
-Foochuck
View Replies !
View Related
Please Help Me Loop This Audio (should Be Simple)
hey guys,
I've designed an audio interface that plays streamed audio files that I have saved as mp3's on my server. It works great but, when the first song ends, it plays the second song etc. I want it to loop the current song (until the user requests otherwise). What should I add to the following script?
thanks very much,
brandy
.................................................. .....................
_global.songs = new Array();
_global.playing = "no";
_global.currentSong = 1;
_global.songs[1] = "song1.mp3"; //the mp3 file uploaded into the same directory in the ftp as the swf file
_global.songs[2] = "song2.mp3";
_global.songs[3] = "song3.mp3";
_global.playSong = function(){
if(_global.playing != "yes"){
_global.stopSong();
_global.songObject = new Sound();
trace(_global.songs[_global.currentSong]);
_global.songObject.loadSound(_global.songs[_global.currentSong],true);
_global.songObject.onSoundComplete = function(){
_global.nextSong();
_global.playSong();
}
_global.playing = "yes";
}
};
_global.stopSong = function(){
_global.songObject.stop();
_global.playing = "no";
};
_global.nextSong = function(){
numSongs = _global.songs.length;
numSongs -= 1;
if(_global.currentSong < numSongs){
_global.currentSong += 1;
}else{
_global.currentSong = 1;
}
if(_global.playing == "yes"){
_global.stopSong();
_global.playSong();
}
trace(_global.currentSong);
};
_global.prevSong = function(){
numSongs = _global.songs.length;
numSongs -= 1;
if(_global.currentSong > 1){
_global.currentSong -= 1;
}else{
_global.currentSong = numSongs;
}
if(_global.playing == "yes"){
_global.stopSong();
_global.playSong();
}
};
_global.volumeUp = function(){
vol = _global.songObject.getVolume();
if(vol < 100){
volume_txt.text = vol;
vol += 5;
_global.songObject.setVolume(vol);
}
};
_global.volumeDown = function(){
vol = _global.songObject.getVolume();
if(vol > 0){
volume_txt.text = vol;
vol -= 5;
_global.songObject.setVolume(vol);
}
};
_global.playSong();
View Replies !
View Related
Simple Little For Loop Problem -- PLEASE HELP
I am trying to dynamically populate buttons through a for loop. These buttons are generated by the duplicateMovieClip action, here is what I am looking at:
code:
for (var i = 1; i<arraySize; i++) {
//this code omitted
//trace 1
trace(_root.productURL[i]);
this["foo"+i].onRelease = function() {
getURL(_root.productURL[i]);
//trace 2
trace(_root.productURL[i]);
};
}
productURL is an array defined at the root.
Trace 1 returns the element at the last index of the array
Trace 2 return "undefined"
I know this is something simple. Any help would be greatly appreciated
View Replies !
View Related
Simple Loop Question
Hey everyone,
I have basic looping question. If I had a 3 onEnterFrame statements that I wanted to write such as
delete box1.onEnterFrame;
delete box2.onEnterFrame;
delete box3.onEnterFrame;
What is the correct syntax. I have this but it didnt work. Any thoughts? Thank you for your help.
for (i=0; i<4; i++){
mc=this["box"+i]
delete mc.onEnterFrame;
}
View Replies !
View Related
Simple Loop Kicking My Ass
I have a MC named cannon
I have aMC button named but_mc
I just want the mc cannon to rotate when I press the button. As long as rotation is less than 100.
Im ready to thrash the monitor so a quick response is appreciated..
var i:Number = 20;
_rotation = 0
but_mc.onPress = rotatecannon;
function rotatecannon ()
{
while (_rotation < 100)
//condition test
trace (_rotation);
cannon_mc._rotation = _rotation + 1;
i++;
//increment
}
View Replies !
View Related
Simple For Loop And This Question
Hey Everyone,
I have a pretty simple task which requires me to have the value of a variable be constantly updated. The value of i in this case always stays at 3 since the for loop runs through everything one time. Ideally I want it to constantly reflect the "i" as associated with the ball that one is rolling over. Hope this makes sense. Thanks for the help.
for (i=0; i<3; i++){
theball=this["ball"+i];
theball.onRollOver=function(){
_root.thetextbox.text="Hello " + i;
}
}
View Replies !
View Related
Simple Loop- Missing Something
hi all, while continuing my quest to "sample colors" i made a small little test app with the following code.
Code:
function getSample() {
bmp.draw(mcHolder);
sample = bmp.getPixel(_xmouse, _ymouse);
newColor = sample.toString(16);
//return newColor;
changeBoxColor(newColor);
//hexadecimal formula- can use this variable later to pass to new color
}
//____________________________________________________________________add mouse listener
var oMouseListen:Object = new Object();
oMouseListen.onMouseDown = function() {
getSample();
};
Mouse.addListener(oMouseListen);
//____________________________________________________________________ change sample box to selected color
var box = sampleBox_mc0.theBox;//make 5 instances of this guy
var txBox:TextField = sampleBox_mc0.txSample;
var border=sampleBox_mc0.mcBorder
function changeBoxColor(newColor) {
thisColor = "0x"+newColor;
var boxColor:Color = new Color(box);
var txStyle:TextFormat = new TextFormat();
txStyle.color = thisColor;
boxColor.setRGB(thisColor);
txBox.setTextFormat(txStyle);
}
box.onRelease=function(){
setBorder(this);
this.selectedBox=true;
}
works fine. However, i would like to add 4 more instantces of "box" . i was trying to do this with a loop, but not finding success...any ideas
Code:
//____________________________________________________________________ get pixels function
function getSample() {
bmp.draw(mcHolder);
sample = bmp.getPixel(_xmouse, _ymouse);
newColor = sample.toString(16);
//return newColor;
changeBoxColor(newColor);
//hexadecimal formula- can use this variable later to pass to new color
}
//____________________________________________________________________add mouse listener
var oMouseListen:Object = new Object();
oMouseListen.onMouseDown = function() {
getSample();
};
Mouse.addListener(oMouseListen);
//____________________________________________________________________ change sample box to selected color
box = [];
txBox = [];
function changeBoxColor(newColor) {
for (i=0; i<4; i++) {
var txStyle:TextFormat = new TextFormat();
thisColor = "0x"+newColor;
box = sampleBox_mc[i].theBox;
txBox = sampleBox_mc[i].txSample;
boxColor = new Color(box);
boxColor.setRGB(thisColor);
txBox.setTextFormat(txStyle);
txStyle.color = thisColor;
}
}
box.onRelease = function() {
};
View Replies !
View Related
Very Simple Mp3 Loop Player
Hi !
I'm currently working on my music website and have a request for help.
I just designed a little interface on flash for a loop player. As you can see on the image it's just 5 numbers (one loop each) that can be played by clicking on a number, and the square on the right is the "stop" button.
Is it complicated to make this loop player with Flash 8?
Thanks.
In2sky.
View Replies !
View Related
[F8] A Simple Loop Problem
I want to create a loop so I dont have to type this
Code:
A1_btn.tabEnabled = false;
A2_btn.tabEnabled = false;
A3_btn.tabEnabled = false;
A4_btn.tabEnabled = false;
A5_btn.tabEnabled = false;
A6_btn.tabEnabled = false;
A7_btn.tabEnabled = false;
A8_btn.tabEnabled = false;
A9_btn.tabEnabled = false;
A10_btn.tabEnabled = false;
Im a little rusty at loops so i tried creating this
Code:
for (var i:Number = 1; i <= 10; i++) {
tab = ("A"+i+"_btn");
tab.tabEnabled = false;
}
but it doesnt work. can anyone point me to the right direction?
thanks
View Replies !
View Related
Stumped On A Simple Loop
OK, this should probably go in the newbies section 'cos I'm sure that there is a simple answer but I've been wrestling for 24 hours now and getting nowhere...
I have a simple loop to make a series of MCs transparent but for some reason it doesnt happen.
In the output panel everything looks OK and when I just write the same thing in the code, hey presto! it disappears.
All my MCs are identical and instanced r1, r2, r3 ....r18
the loop is:
onClipEvent (load) {
for (i=1;i<10;i++) {
var img='r'+i;
img+='._alpha=0;'
img='this._parent.'+img
trace(img);
img;
}
}
The trace shows exactly the correct string i.e: (AND when I type these strings into the code, yes it works!)
this._parent.r1._alpha=0;
this._parent.r2._alpha=0;
etc.
but nothing disappears. I have tried various different use of variables to build up the appropriate string eg
var img='r'+i
var img='r'+i+'._alpha=0'
var img='this._parent.r'+i
etc.
but nothing seems to work. What's the catch. I am sure that there is something that I just haven't considered but for the life of me I don't know what it is....
HELP
View Replies !
View Related
Simple Loop Question
hi
i am trying to make mc's appear on the stage one by one then stop after they reach 100.
so far they only appear all at once:
Code:
for (i=0; i<100; i++) {
var ballmc:MovieClip = attachMovie("ball", "ball_mc"+i, i);
ballmc._x = Math.random()*Stage.width;
ballmc._y = Math.random()*Stage.height;
}
how would i make them appear one by one and stop when the count reached 100?
thanks!
View Replies !
View Related
Simple Move And Loop
I know this is very noob, but I need a simple AS move and loop.
Move an object across the stage (left to right) and once out of site, loop and start over again? It needs to be a slow and endless loop.
Please explain as simply as possible.
View Replies !
View Related
Simple For Loop And If Problem...
Hi I have a problem with the following script. I'm sure its really simple but I'm feeling pretty brain dead at the moment and just can't sort it. Can anyone help?
All i have is a text file with some variables in which are either sold or sale. I want to read these in and perform some actions depending on what the string is.
Here is my script....
Code:
statusVar.onLoad = function(success) {
if (success) {
trace("done");
for (i=0; i<numberOfPlots; i++) {
plot = "plot"+(i+1);
statusOfPlot = statusVar[plot];
trace("status: "+statusOfPlot);
if (statusOfPlot == "sold") {
trace("SOLD");
}
if (this.statusOfPlot == "sale") {
trace("SALE");
}
}
}
};
The problem is that the if statements are only being tested for the last statusOfPlot value and I want them to be tested each time a new statusOfPlot variable is created.
Thanks
View Replies !
View Related
Simple For Loop Question
I'm trying to get this for loop to trigger a number of movieClips to go to the same frame. My script should be working, but isn't. Here is the code:
for (i=0; i<_parent.generalNavArr.length; i++) {
_parent.generalNavArr[i].gotoAndStop(1);
}
The information is coming through from the array just fine...if I control each individual movieClip with this following code it works fine:
_parent.art.gotoAndStop(1);
_parent.web.gotoAndStop(1);
_parent.ad.gotoAndStop(1);
...etc
Any help would be great! Thanks.
View Replies !
View Related
Simple For Loop Problem
The code below returns a syntax error, but I can't figure out why. It's to do with the '[i]' bit, but I don't know what the correct syntax should be, or where to look to find out.
Code:
for (var i=1; i <= 10; i++) { main_mc.bkg[+i]_mc._alpha = 0; }
Can anyone help?
View Replies !
View Related
Simple Loop Questions
I created this loops just because I have many variables I want to set easily to true and false, but when i do allConditions = true, it wont work. How do i set condition1 to condition 43 to true and false in this case?
for (i=1; i<43; i++) {
allConditions = "condition"+i;
}
View Replies !
View Related
Loop Flv Video (simple)
How do I get my video to loop with this code?
Currently the video plays to the end and stops.
This code calls/plays the video from the desktop, there is nothing in the library? I have tried many things with no luck. What else do I add?
Are there any working fla files somewhere for download to see how they action script 3.0 can handle video?
//-------------------------------------
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play("duck_float.flv");
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
addChild(video);
function onMetaData(data:Object):void
{
}
View Replies !
View Related
Simple For Loop Question
I'm making a transition to AS3 and have a question about referencing the names of the children. I'm attaching a number of items onto the stage with a for loop and, once they are on the stage, I'm having trouble accessing them. "p" is the name of the item and if I trace "p" after I place everything on the stage it only accesses the last item. How can I access, for example, the 13th item? I can't seem to figure that out...I'm thinking the solution is easy.
Thanks in advance.
var xLocation=-4000
var itemRotation=-65;
for (var i:uint=0; i<25; i++) {var p:Plane = new Plane(bam, 234, 236, 2, 2);
scene.addChild(p);
p.x = xLocation;
p.y = 500;
p.z = 500;
p.rotationY = itemRotation;
xLocation=xLocation+350;
itemRotation=itemRotation+5;}
View Replies !
View Related
Help With Simple Loop Problem
Hey everyone,
I'm trying to loop through my xml file and retrieve each <img> nodes firstChild, which is promo1, promo2, promo3, etc.
I have copied a short piece of xml that's similar to mine.
I have my .fla looping through and fading in and out the image node. My problem is that when I go to loop and fade in the text, which is really fading out the mc, it doesn't loop to the next node. Which is promo2.
eg.
-The mc fades out revealing the text(promo1).
-After the mc fades back in hiding the text
-It should loop down to the next node, fading the mc back out, revealing the text(promo2).
-etc. and continue looping as long as thier are childNodes.
It's looping but not correctly!
Here's my AS:
Code:
load_xml = new XML();
load_xml.ignoreWhite = true;
load_xml.onLoad = function(success) {
if (success) {
process(load_xml);
} else {
trace("Something is wrong, we're not opening!");
}
};
//Load up the XML file into Flash
load_xml.load('images.xml');
//---Function that will be called when xml loads succesfully
//xmlDoc_xml is now a reference to the XML object where our information is stored
item_arr = new Array("img", "startdate", "enddate", "url");
var cnt=0;
function process(xmlDoc_xml) {
mc.fade(0,7);
var count=0;
for (var n = 0; n<xmlDoc_xml.firstChild.childNodes.length; n++) {
if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "promo") {
var cnt1=cnt;
for (var i = 0; i<xmlDoc_xml.firstChild.childNodes[n].childNodes.length; i++) {
if (xmlDoc_xml.firstChild.childNodes[n].childNodes[i].nodeName == item_arr[i]) {
trace(xmlDoc_xml.firstChild.childNodes[n].childNodes[i].firstChild.nodeValue);
}
}
trace("Is it working "+xmlDoc_xml.firstChild.childNodes[count].childNodes[0].firstChild);
output = xmlDoc_xml.firstChild.childNodes[cnt1++].childNodes[0].firstChild;
}
trace("Come to poppa " +xmlDoc_xml.firstChild.childNodes[count].childNodes[0].firstChild.nodeValue);
count++;
trace("here count=" + count);
//This is where the loop ends
}
}
MovieClip.prototype.fade = function(endAlpha, speed) {
trace("called11");
if (this._alpha>endAlpha) {
speed *= -1;
}
this.onEnterFrame = function() {
if (Math.abs(endAlpha-this._alpha)>Math.abs(speed)) {
this._alpha += speed;
} else {
this.onEnterFrame = undefined;
myInterval = setInterval(beginFadeOut, time());
this._alpha = endAlpha;
}
};
};
MovieClip.prototype.fadeIn = function(begalpha, speed) {
trace("called22");
this._alpha = 0;
if (this._alpha<begalpha) {
speed *= -1;
}
this.onEnterFrame = function() {
if (Math.abs(begalpha-this._alpha)>Math.abs(speed)) {
this._alpha -= speed;
} else {
process();
this._alpha = begalpha;
}
};
};
function beginFadeOut() {
clearInterval(myInterval);
mc.fadeIn(100, 7);
}
function time() {
sec = ((30/5)*1000);
trace("seconds called");
return sec;
}
//function loop(){
//if(count!=null){
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<images>
<promo>
<img>promo1.jpg</img>
<startdate>01/02/2003</startdate>
<enddate>01/03/2003</enddate>
<url>website</url>
</promo>
<promo>
<img>promo2.jpg</img>
<startdate>01/12/2003</startdate>
<enddate>31/12/2003</enddate>
<url>website</url>
</promo>
<promo>
<img>promo3.jpg</img>
<startdate>01/12/2003</startdate>
<enddate>31/12/2003</enddate>
<url>website</url>
</promo>
</images>
I would appreciate all the help I can get!
Thanks in advance,
cbs
View Replies !
View Related
Can't End A Simple Rainstorm Loop (doh)
Been away from Flash for quite a while and have gone rusty. I have a raindrop movie clip that is duplicated randomly to generate a rainstorm. I want to end the rainstorm then start another movie.
I'm so dang rusty I can't figure out how to end this very simple loop.
Here's the ActionScript that duplicates the raindrop:
n = Number(n)+1;
setProperty("drop", _x, -1+Math.random()*763);
setProperty("drop", _y, -37+Math.random()*30);
duplicateMovieClip("drop", "", n);
The loop is generated by Frame 2's script of going back to and playing Frame 1.
Of course, that's the problem. Eventually the rain has got to end. Been sitting here reading Foundation ActionScript for hours but cannot find how to keep this loop going for a while then ending it and moving on to a sunrise or something.
Any suggestions? Any help is always greatly appreciated.
-Peg
View Replies !
View Related
Problem With Simple For-loop
Can anyone tell me why this code doesn't work?
Code:
pic_amount=10;
for (i=1; i<pic_amount; i++) {
pic = "this.pic"+i;
picpath = "gallery/pic"+i+".jpg";
pic.onRelease = function() {
loadMovie(picpath, "_root.container.pic_container");
};
}
View Replies !
View Related
|