Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




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
}



FlashKit > Flash Help > Flash Newbies
Posted on: 12-11-2005, 03:05 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Why Isn't My Cache Kicking In?
Hi all.

I have some large swf's, between 2 and 3 meg. After I have loaded them, I can see them in my temporary internet files but the next time I go to them they re-download and another version pops up in the temp files. I don't want people to have to keep loading.

Any ideas?

Kicking Animation
i have started to make a web site for my soccer team and i am making a little flash intro for first page, you can find it here i want to make the seahorse appear to kick the ball but am not sure how best to go about it without making it look stupid, any advise on how to make this effect look good is appreciated. i have tried straightening the tail but it looks poor, how do you guys go about making animations morph like that any techniques needed etc.. also im not sure if you notice but the animation is very bitty if you know what i mean, with the ball and the enter sign distorted why is this?

thanks in advance barry

Inventory Kicking The Shi* Out Of Me
These are the links to my threads on it.
the full file and code
and...

my problem with it

Inventory Kicking The Shi* Out Of Me
These are the links to my threads on it.
the full file and code
and...

my problem with it

PHP Kicking My Butt
I have built an email form using PHP

it works fine when i am previewing the site form my hard drive. but after i uploaded the site to the server...no joy...i get a messaged failed error each time.

the only change i made was putting the PHP file into the website folder on the server...

and then I changed the address inside the action script

any help would be great as this is the one of the last nails in this site.

thanks

Ponyack

[F8] Flash Is Kicking My Ass
Hello folks, I need a little actionscript help.

Visit www.kashikicks.com to see what i'm describing below

I have a MC the contains numbers 1-40 lined up in a row. When you rollover each number, the rollover state displays a shoe down below. I need that when the numbers are clicked, the image of the shoe stays.

If I turn those rollover states, into movie clips, Can't I load that MC to the position I need it in with just a few lines of code?

Right now the only known process for me is creating keyframes on every frame witha different picture on each one and a 'stop' command. Then telling all the buttons to go there and stop. what can I say i'm a newb. Any help?

XML Kicking My Butt
I have no idea what i am doing.
I have the XML & Actionscriting set up too pull in all of the info in, But i cant not for the life of me get the URL's to work.

And if there are Hints on how to clean this up, That would be great

var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news.xml");

/////////////////////////////////////
xmlData.onLoad = function(loaded){
if (loaded) {
xmlNode = this.firstChild;
image = [];
headline = [];
caption = [];
nav = [];
fullstory = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
headline[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
caption[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
nav[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
fullstory[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
strURL[i] = xmlNode.firstChild.childNodes[4].attributes.url;
}
firstImage();
navtext();
} else {
content = "file not loaded!";
}
}

/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
}
if (Key.getCode) {
btnOne();
btnTwo();
btnthree();
btnfour();
}

else if (Key.getCode() == Key.RIGHT) {
firstImage();
}
};

Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage()
};
btn_one.onRelease = function() {
btnOne();
clearInterval(myInterval);
};
btn_two.onRelease = function() {
btnTwo();
clearInterval(myInterval);
};
btn_Three.onRelease = function() {
btnthree();
clearInterval(myInterval);
};
btn_Four.onRelease = function() {
btnfour();
clearInterval(myInterval);
};

/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 5;
}
if (desc_txt._alpha<100) {
desc_txt._alpha += 10;
}
}
};

function btnOne() {
p=0;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[0];

}

function btnTwo() {
p=1;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[1];
}

function btnthree() {
p=2;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[2];
}

function btnfour() {
p=3;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[3];
}

function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
slideshow();
}
}

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = headline[p];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[p];
slideshow();
}
}
}

function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = headline[0];
caption_txt.text = caption[p];
one.fullstory_txt.text = fullstory[0];
slideshow();
}
}

delay = 3000;

function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage()
} else {
nextImage();
}
}
}

function navtext() {
nav1_txt.text = nav[0];
nav2_txt.text = nav[1];
nav3_txt.text = nav[2];
nav4_txt.text = nav[3];
}






///////////////////////////////////////////////////////////////////////////////////////////////



<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>news_images/hura.jpg</image>
<headline>text</headline>
<caption>text</caption>
<nav>text</nav>
<fullstory url="http://www.google.com/">1</fullstory>
</pic>
<pic>
<image>news_images/meso.jpg</image>
<headline>text</headline>
<caption>text</caption>
<nav>text</nav>
<fullstory url="http://www.yahoo.com/">2</fullstory>
</pic>
<pic>
<image>news_images/ortho.jpg</image>
<headline>text</headline>
<caption>text</caption>
<nav>text</nav>
<fullstory url="http://www.msn.com/">3</fullstory>
</pic>
<pic>
<image>news_images/stent.jpg</image>
<headline>text</headline>
<caption>text</caption>
<nav>text</nav>
<fullstory url="http://www.photo.com/">4</fullstory>
</pic>
</images>

Preventing Screensavers From Kicking In?
Is there anyway of stopping a users' screensaver from kicking in, when viewing a Flash Movie. I'm developing a Flash presentation which gives the user the option of navigating it themselves or watching it in it's entirety. Is it possible to envoke a key press or a mouse move (or another method) which could prevent a screensaver from starting up

Action Script Is Kicking My *ss
Ok this action script has got me by the b*lls(and I'm a girl) ,I want to asign actions to 9 buttons, on button press or release the button calls a movie clip of a scrolling pane with info that flies in from left stage and opens for user view (here is where it gets difficult for me), now on pressing a different button I want the movie clip on view to close and retreat the same way it came in, and a new movie clip to fly in and open the same way the previous one did, and I want the same actions to happen when I press the other buttons. In a nutshell everytime I click on a button, I want it to make the previous clip exit and call in a new clip to position and so on.

could someone please take the time to explain this to me. please note that I'm very new to action scripts.

Thanks in advance.

Kicking Off A Mac Projector File
hello...
i've published a mac projector file from flash to a CD-ROM, any idea how i can get this to autostart on macs? i'm use to working on a pc and using the .inf file, is there something similar for macs?

thanks, pm

Flash Kicking Game
I am looking to build a simple field goal kicking game and need help on the logic for the ball moving once power and accuracy have been defined. Any help at all is apprciated.

Thanks

Flash Kicking Game
I am looking to build a simple field goal kicking game and need help on the logic for the ball moving once power and accuracy have been defined. Any help at all is apprciated.

Thanks

Site Not Kicking Into Section After Preloader
I have preloaders on all of the different sections to this site: www.davidbeahm.com
The gallery section ( the largest section, about 4 meg) doesn't kick into the section after it is loaded fully. The preloader just continues to run while you can see at the bottom of the screen that the page is fully loaded (it says "done"). Why is this happening? How can I insure that the page opens properly when fully loaded coming from a preloader?

[CS3] Kicking Off A Javascript From Flash Help Me :) Please Anddddd Thank You
Alright so heres the deal.
I want a SIMPLE task to perform. I have a button in flash that I want to when I press it to kick off a javascript function a SIMPLE hello world function. as I have it right now


PHP Code:



import com.macromedia.javascript.JavaScriptProxy;
var proxy:JavaScriptProxy = new JavaScriptProxy( );
on (release) {
    proxy.hello("");
}




Then within my HTML I have the following javascript


PHP Code:



<script src="js/Exceptions.js" language="javascript"></script>
<script src="js/FlashProxy.js" language="javascript"></script>
<script src="js/FlashSerializer.js" language="javascript"></script>
<script src="js/FlashTag.js" language="javascript"></script>

<!-- THIS IS MY HELLOW WORLD FUNCTION -->
<script type="text/javascript">
    function hello(){
        alert("hello World");
    }
</script>




But I am unable to actually kick off the alert and Im kind of stuck. Anyone out there please help

Remote Shared Object Kicking My Butt
After 4 days, I'm still stuck with what should be a simple learning exercise. I'm not a newbie developer by any means so this shouldn't be beyond me. After a couple weeks of reading, I'm now trying to do some bite size exercises to ramp up on Communication Server (using Flex as the back end ). I'm missing something in my understanding and could use a good quick swift kick in the pants to get me going.

All I want to do is created a server side remote object, then when a client connects, send and add a simple string to the remote object. Then have the client receive the update and display the information in a text box. Below is the code I'm trying to use, cleaned up a bit (so their might be a typo or two). It captures the idea of what I'm trying to do.

I'm not sure what I'm doing wrong. The idea is to send a test string to the server on connect, and have the server add it to the server side shared object. In theory, I think, this will fire the client's onsync event to send the change back to the client. The onsync fires but I'm not seeing the information in the client... just get an 'undefined'.. What am I missing? Save me a week of pulling out my hair, if you can, please!

Thank you!

==================server asc================================
application.onAppStart = function()
{
trace("onAppStart");
//create server side shared object
test_so = SharedObject.get("myTestSharedObject");
}
application.onConnect = function (client, someTextForDisplaying)
{
test_so.setProperty(myProperty, someTextForDisplaying);
return true;
}

==================client ================================
var my_so: SharedObject;
var nc:NetConnection;

//this is triggered by a UI button click
function createConnection():void
{
//connect to the server
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler );
nc.objectEncoding = ObjectEncoding.AMF0;
//
nc.connect( "rtmp:/testApplication", "testString");

}

//connected so now connect the client to the server side remote object
function netStatusHandler( event:NetStatusEvent ):void
{
switch( event.info.code ) {
case "NetConnection.Connect.Success":
// Connection succeeded now create components
// Simple User shared object and event handling
SharedObject.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;

my_so = SharedObject.getRemote("myTestSharedObject", nc.uri, false);
my_so.addEventListener( SyncEvent.SYNC, usersSyncHandler );
my_so.connect( nc );
break;
case "NetConnection.Connect.Rejected":
Alert.show( "Connection Rejected.", "Something went wrong" );
break;

}
}

//this is the event fired when the remote shared object changes
function usersSyncHandler( event:SyncEvent ):void
{
//show the returned information on the UI
txtDisplay = event.target.data.myProperty;
//or
txtDisplay = txtDisplay + my_so.data.myProperty;
}

[CS3] Simple Image Loop Not So Simple
I'm relatively new to Flash - I can do some basic animations but very little actionscript.

I'm looking for a tutorial to have a set of images scroll across and repeat themselves.

this is what I'd like... example

I can do a continuous loop of a simple background image with the 'goto' function, but I can't even find a tutorial on how to repeat individual images.

Any suggestions?
Thanks,
JTN

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!

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

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!!!

A Simple Loop
i am really new to this stuff, can anyone show me how to use a simple loop?

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!

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?

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.

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;
}

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;
}

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

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!

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++;
}
}

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.

Simple Loop Q
hi guys how would i continually loop this

_root.clip.tween("_x",560,3,customEasing);

big thx to all who post

Loop Animation. So Simple ..and Yet....
I have a 100 frame animation. All I want to do is let it run 3 times then stop it. Should not be that hard, it would seem. Help!

(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!!!

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...

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

Help With Simple Loop Animation..
i have about 10 little gif images that i want to be able to loop in a circle. Can some help me with what I need to do with the image preparation and the actionscript to make an infinate loop?

thanks ahead of time for your help.

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();

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

Simple Music Loop ?
I want this to loop but drawing a blank on the line to add to this to have it do so.

myMusic = new Sound();
myMusic.loadSound("Song31.mp3", true);


Thanks

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;
}

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;
}
}

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() {
};

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.

[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

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

What's Wrong With My Simple For Loop?
PHP Code:




for (var i:int=1; i<18; i++){
    var tFish = new "tiny"+i+"_mc()";
    tinyHolder.addChild(tFish);
}

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!

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.

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

Copyright © 2005-08 www.BigResource.com, All rights reserved