Help Me Kick My For Loop Addiction
Hello.
I'm trying to create a random grid quickly without crippling Flash to much. However my over reliance on loops causes the 256 loops error to appear (thinking I've created an infinite loop by accident). If I add a slight pause into the loop (onEnterFrame or setInterval) it works (albeit slowly). In nutshell I want to try and cut down on the number of 'condition testing' loops if possible.
var maxWidth = 480; //horizontal area width
var maxHeight = 320; //vertical area width
var unitSize = 10; // this is the unit size
var maxXcount = maxWidth / unitSize; // number of units horizontally
var maxYcount = maxHeight / unitSize; // number of units vertically
for (i=0; i<maxXcount; i++){
grid = new Array();
for (j=0; j<maxYcount; j++){
grid[j] = false;
//trace("grid["+i+"]["+j+"] = "+grid[j]);
}
}
I started off by defining the max dimensions of the area and the size of the units within that area. Then looped through these to create a dual array which amounts to var gridElement [XPOS] [YPOS], doing nested loops to create this. No problems here. Every entry is set to false and used as an 'activatation' marker.
My problem lies hereon. If I stick with a fixed size the process is easy, it's my random size generator that seems to cause the issue. To create random sized shapes within this gird (that fit exactly) I end up adding more equations to the mix. Starting at 0,0 by the grid array, I loop from the current x position through to the maximum shape width + current x pos checking true/false to see if that grid entry is being 'used' or not. A counter inside the loop is increamented, if no match is found the full random value is used, if a match is found or the random width+xpos exceeds the max area width, the loop 'breaks' and the current increament counter value is used instead.
This process is repeated for the Y axis (mainly to test the height hasn't exceeded the max Area height).
var xCount;
var yCount;
for (i=0; i<maxDimension; i++){
xCount = i;
if (grid[(i+gridXCount)][gridYCount] || (i+gridXCount)>=maxXcount){ // check horizontally for 'TRUES' and not bigger than the X size of grid (maxXCount);
break;
}
}
for (j=0; j<maxDimension; j++){
yCount = j;
if (grid[gridXCount][j+gridYCount] || (j+gridYCount)>=maxYcount){ // check vertically for 'TRUES' and not bigger than the size of Y grid (maxYCount);
break;
}
}
var xWidth = randRange(1, xCount); // Get a random size 1 - (5 or smaller depending what else is around)
var yWidth = randRange(1, yCount); // get a random size 1 - (5 or smaller depending what else is around)
After the loops are finished, I now have my random shape which will not write over an existing shape and will not spill out of the main grid area. So now I do one last loop to make all the grid entries which fall inside this shape are set to true so they don't get reused.
for (j=gridYCount; j<(gridYCount+yWidth); j++){ //Set the Grid to true
for (i=gridXCount; i<(gridXCount+xWidth); i++){
grid[j] = true;
}
}
Then I jump the main X count on by the width of the new shape and start the process again test whether the current X,Y grid entry is true or false, if it is false it does the Maths again, if true the Xcounter jumps on 1 and tries again.
This system does work, but because I have to introduce a delay in the looping it causes quite a delay at the start when the swf is played. I just wondered if there's a less loop intensive way so I could also do away with the delay between each loop.
I know this is alot to ask, but any help or pointers on this matter would be greatly appreciated.
Many thanks,
Meeeeesta
Adobe > ActionScript 1 and 2
Posted on: 05/23/2008 04:17:27 AM
View Complete Forum Thread with Replies
Sponsored Links:
- Kick Me
- If I Could Only Kick Flash Mx.................
- Just Need A Kick Start
- Need A Kick In The Right Direction
- After A Kick In The Right Direction
- Need A Kick In The Right Direction
- I'm New, So Please Don't Kick Me For Asking This Question
- Movie CLIP Needs A Kick? Help
- I Have A Kick Ass Idea, Im Looking For Someone Who Wants To Help Me Make It
- Key Control L.R.U.D Kick Punch
- -::: Game - Kick Up Style :::-
- Ball Kick Code
- How Did They Make This Kick Ass Preloader?
- Kick Ball Physics Help
- How Did They Make This Kick Ass Loader
- Preloader Doesn't Kick In Soon Enough
- Way To Kick This Kind Of Listener
- Kick A Function In Flash From HTML ?
- Kick A Function In Flash From HTML ?
- Thanks For Not Letting Flash Kick My Butt
- Thanks For Not Letting Flash Kick My Butt
- Flash Remoting Kick-start
- HitTest Penalty Kick Game
- Kick A Function In Flash From HTML ?
- How Do U Make The Matrix Kick Were The Screen Turns
- Walk,Kick,Punch,3D,Sound,Action Script
- Any Advice Complete Novice In Need Of A Good Kick Start
- [CS3] I Had A Dyslexic Bully Who Would Put "Me Kick" Signs On My Back.
- Any Way Around The Loop Error (loading 8000 Vars, Flash Thinks Its A Loop.)
- How Do I Define The Greatest _x Position Based On A Loop, Assuming I Know The Last Element Of The Loop?
- I Would Like My Sound Loop To Continously Loop Without Looping Over Itself When I Repeat My Images.
- LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
- Loop Inside Loop... Why Doesn't Work Properly?
- Function Inside For Loop; How To Give It Parameters Of The Loop
- Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
- Loop Help: XML Attribute Doesnt Stay On Each Object Of The Loop
- Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
- My Sound Loop Is Repeating Itself Ontop Of Previous Loop
- Movie Clips In For Loop Onlydisplaying In 1st Loop
- Mp3 Sound Loop Bad. Wav Loop Good.
- [MX04] Loop Loop Whoops
- Stop Loop And Replay Loop
- Loop Within A Loop (creating 2 Columns)
- XML Nested Loop - Access The Loop Later... But How?
- GrRR Loop, Loop,loop
- SIMPLE LOOP-D-LOOP
- Loop De Loop Need To Stop
- MP3 Loop Script Won`t Loop
- For Loop With Xml - Cant Understand The Loop
- Running A Loop Within A Loop
- For Loop In For Loop Problem
If I Could Only Kick Flash Mx.................
Hey guys, i've got a prob and i'm totally stumped
instead of trying to confuse everyone with a long winded description, i'll just poste the code and my prob.
Code:
onClipEvent(load){
max=4
i=0
px =260
py =0
}
onClipEvent(enterFrame){
if(i < max){
j="jeep"+ i
jimg =j+".jpg"
jlnk = "jeeppics/" + jimg
attachMovie("Misc","misc"+i,10+i)
mov="misc"+i
mov._x= px+10
mov._y = py
px += 100
i ++
}
}
ok basically, it loops throu 4 at a time, and should place the mc's 10 px apart, but when i "trace(mov._x)" i get undefined. Now if i change "Mov._x.." to read "misc0._x=..." it sticks it in its place. Otherwise, it seems like the mc's just pile up on eachother. any help would be great!
thanks a bunch
View Replies !
View Related
Just Need A Kick Start
I am new to actionscripting and Flash. I have played with animations, but never really did anything with them.
I am trying to make simple button for a navagation menu so that I can have them click on it and take them to another html page.
I have struggled with it but never got it right. I have my nemu items as buttons, I have put them on the stage and gave them the code to open a url. Problem is when I ren the movie, the items are not clickable.
One thing I think is the problem is that I created a button, then just put the text I wanted on it. I have tryed putting a square box on the hit frame around my text. i read that in a tutuorial some where so that flash knows the clickable area.
Well it seems now that the box is behind the text, so that when I mouse over, it only activates if I am not on the text itself, only around it.
Can someone enlighten me as to what I am doing wrong?
View Replies !
View Related
Need A Kick In The Right Direction
Thanks for looking.
I am trying to create a volume slider (done) that has a little speaker icon on it that reads where the dragger is on the line, converts it to a ratio, then passes that ratio into a var. If the var is less than 25,50,75, or 100 it is supposed to go and stop on either frame 0,1,2, or 3. Anyway, it doesn't work. Even if I create just a local variable it doesn't work.
on _root here is my actionscript:
this.onEnterFrame=function(){
ratio.text=mySlider.ratio;
}
_global.speaker:Number=mySlider.ratio;
on one of the sub layers (level 3) here is my actionscript:
this.ratio=0 ;
dragger.onPress=function(){
this.startDrag(true,0,0,line._width,0);
this.onEnterFrame=function(){
ratio=Math.round(this._x) ;
_global.speaker:Number=ratio;
}
}
dragger.onRelease=dragger.onreleaseOutside=stopDra g;
//this doesn't work, even with a local var
var speaker:Number=(57);
if (speaker < 25){
gotoAndStop ("framezero");
}else if (speaker < 50){
gotoAndStop ("frameone");
}else if (speaker < 75){
gotoAndStop ("frametwo");
}else {
gotoAndStop ("framethree");
}
To see the source file if that would help please go to theharmonfam.com/download
Thanks in advance
View Replies !
View Related
After A Kick In The Right Direction
hi all
i want to create a simple chatroom based in flash ideally using php backend. i haven't done anything like this before and am after a point in the right direction as to where to start in the coding process. i've read somewhere that using xml might be an option.
can you build a chatroom on Flash media server (free developers edition)?
So could you direct me where to start?
Does anyone know of a good tutorial for creating a chat room?
Thanks in advance,
Jon
View Replies !
View Related
Need A Kick In The Right Direction
Thanks for looking.
I am trying to create a volume slider (done) that has a little speaker icon on it that reads where the dragger is on the line, converts it to a ratio, then passes that ratio into a var. If the var is less than 25,50,75, or 100 it is supposed to go and stop on either frame 0,1,2, or 3. Anyway, it doesn't work. Even if I create just a local variable it doesn't work.
on _root here is my actionscript:
ActionScript Code:
this.onEnterFrame=function(){
ratio.text=mySlider.ratio;
}
_global.speaker:Number=mySlider.ratio;
on one of the sub layers (level 3) here is my actionscript:
ActionScript Code:
this.ratio=0 ;
dragger.onPress=function(){
this.startDrag(true,0,0,line._width,0);
this.onEnterFrame=function(){
ratio=Math.round(this._x) ;
_global.speaker:Number=ratio;
}
}
dragger.onRelease=dragger.onreleaseOutside=stopDrag;
//this doesn't work, even with a local var
var speaker:Number=(57);
if (speaker < 25){
gotoAndStop ("framezero");
}else if (speaker < 50){
gotoAndStop ("frameone");
}else if (speaker < 75){
gotoAndStop ("frametwo");
}else {
gotoAndStop ("framethree");
}
To see the source file if that would help please go to theharmonfam.com/download
Thanks in advance
View Replies !
View Related
I'm New, So Please Don't Kick Me For Asking This Question
when I try to mask text, and then preview the movie, the mask background object shows up in stead of the masked text. Am I just using the wrong view mode or what?
For example... I was making a button... I created the button's background, and then made a new layer for the text. On the text layer, I inserted a new symbol... in this symbol I typed the word "HOME" then put a rectangle with the desired colors behind it, and masked the text. The problem is that the rectangle is showing up in stead of the masked text
PLEEEEEASE help
Edited: 04/09/2007 at 08:14:49 PM by diamotsu
View Replies !
View Related
Movie CLIP Needs A Kick? Help
Hi
I followed your example for my movie and I am running into some problems.
Please excuse me, for I am New at this. I have a movieclip (instance/mc1) on frame 36 on my root timeline. At the end of this clip on the last frame I have a button that I dragged in (button is tracked as button not menu). I added actions to this button
on press
begin tell target ("/mc2")
(Is this right I have tryed mc2 alone with no slash)
play
end tell target
end on
On the root timeline on frame # 37 I have another clip instance name of mc2
when I test movie it plays all the way the last frame in mc1 where the button is and I click on the button and nothing happens. But if I right
click the mouse, I get a menu with "play" in it. If I scroll to play, then mc2 plays ok.
Does this mean I have targeted MC2 right? Wht will it not play on it own?
Remember, I am a Rock. People have told me so.
If you can send Your ideas to
tlane2@sc.rr.com
Ps. I have been told to add an GOTO and PLay to the button in MC1 button the drop down list doesn't list MC2.
View Replies !
View Related
I Have A Kick Ass Idea, Im Looking For Someone Who Wants To Help Me Make It
hey,
i wouldn't consider myself a newbie, but the thing is, thati have an idea but i have no f***ing idea how to make it.
Ok, you go to my page right? and it has a nav bar on the top of the page with buttons. You click on one of the buttons, and a toolbar drops down the right side of the page. In that toolbar, there will be links and stuff in it. When you click on a link, the toolbar expands to the page width, and turns into the page that the link points to.
Ok, like lets say on the nav bar, i have a link for a page that has alot of different stuff about that certain thing. SO when the toolbar coems dow nthe right, it shows different links for that part....Like thumbnails for example. The thumbnails will show up on the toolbar, and when you click on them, the toolbar expands to the page width, and shows you the full size of the thumbnail.
Books suck.....im one of those people who don't like to read and do it, i just like ot learn how ot do it using a computer...you know, like Hands-On.
Anyone willing to give me a hand???
E-mail me back, or just reply here.
View Replies !
View Related
Key Control L.R.U.D Kick Punch
i know the action script for left right up down. but i want to know how to use other keys so i can have a kick key and punch key as well. and want up to do a jump action like go up to a target height and then drop back down when its hit the target height [all this when i hit the up key.
please heeelp me im so lost
View Replies !
View Related
-::: Game - Kick Up Style :::-
Hi everyone.
Could anyone help me make a game?
Bascally i want to make a game like Pong or break out. Where you have the rectangle at the bottom of the screen. The ball drops down. The player moves the rectangle left and right to deflect the ball. The ball bounces off of the roof and back down where the player rebounds it again.
This is the general idea anyway....
Can anyone help me make this...thanks very very much
All the best
View Replies !
View Related
How Did They Make This Kick Ass Preloader?
http://www.devontracey.com/away.html
Basically, I love the fact that it eases out, and fades out as it reaches the end. It is a very smooth effect.
If you refresh the page, it will do it again.
How can I recreate this type of preloader? All the preloaders I have seen are clunky and don't have an easing effect like this.
Thanks.
View Replies !
View Related
Kick Ball Physics Help
I`m just trying to make a ball go in the correct curve and i just cannot pull it off !
What i`m doing is this .
there is a power par , how hard the ball is kicked and also an angle pointer to point the angle the ball should be kicked at.
I can kick the ball hard..and i can fiddle with my bounce height , but how do i actually mix them , As in when the angle is right up and the speed is really hard the ball should go very high and fall right infront of me again? I`m stumped.
PLEASE HELP !
View Replies !
View Related
How Did They Make This Kick Ass Loader
http://www.devontracey.com/away.html
Basically, I love the fact that it eases out, and fades out as it reaches the end. It is a very smooth effect.
If you refresh the page, it will do it again.
How can I recreate this type of preloader? All the preloaders I have seen are clunky and don't have an easing effect like this.
Thanks.
View Replies !
View Related
Preloader Doesn't Kick In Soon Enough
I've put a preloader on frame 1 of a movie. The code's fine but it doesn't seem to kick in soon enough. When I look at the streaming and the frame by frame graph illustrating an analysis of the loading, it shows I have 37kb on frame 1 and about 2kb on frame 2. Yet only my preloader is on frame 1 and everything else is on frame 2. The preloader bar only shows when about 95% of the movie is loaded.
The preloader works fine with just a large bitmap on frame 2 so its not the preloader.
Is it the fact that the 'everything else' on frame 2 is in fact actionscript which builds the stage from the library using attachMovieclip at runtime? The stage on framed 2 contains only an empty movieclip to which library items are attached.
Any ideas as to what is happening would be greatly appreciated.
View Replies !
View Related
Way To Kick This Kind Of Listener
hi guys!
is there a way to remove this listener?
Key.addListener({onKeyDown:function () {
f_listenWords();
}});
since it has been the only listener that i have been proving and have reacted well in a pocket pc, or being precise in flash 6 as 1.
is there another alternative, if you know one please help.
thx for any!!
View Replies !
View Related
Kick A Function In Flash From HTML ?
Kick a function in flash from HTML ?
--------------------------------------------------------------------------------
Hi Peoples, here is the setup:
I have a .swf called master sitting on an .html page called master.html
In my .swf, I have an empty movie clip sitting on the stage called loader. I have two different movies in my library called movie1 and movie2 and they have been given linkages of "movie1" and "movie2". I also have two functions in the first and only frame of my movie. They look like this:
attachClip1 = function() {
_root.loader.attachMovie("movie1", "movie1", 10);
}
attachClip2 = function() {
_root.loader.attachMovie("movie2", "movie2", 10);
}
What I am trying to do is link to this .html page containing my .swf and run one of the above two functions. So the link I am trying to make could look something like this:
www.website.com/master.html?function=runFlashFunction
with something like this in the .html page:
<script language = "JavaScript">
<!--
function runFlashFunction(){
do something here;
}
//-->
</script>
So can anyone assist me here.
Thanks for your time.
Reflex.
View Replies !
View Related
Kick A Function In Flash From HTML ?
Hi Peoples, here is the setup:
I have a .swf called master sitting on an .html page called master.html
In my .swf, I have an empty movie clip sitting on the stage called loader. I have two different movies in my library called movie1 and movie2 and they have been given linkages of "movie1" and "movie2". I also have two functions in the first and only frame of my movie. They look like this:
attachClip1 = function() {
_root.loader.attachMovie("movie1", "movie1", 10);
}
attachClip2 = function() {
_root.loader.attachMovie("movie2", "movie2", 10);
}
What I am trying to do is link to this .html page containing my .swf and run one of the above two functions. So the link I am trying to make could look something like this:
www.website.com/master.html?function=runFlashFunction
with something like this in the .html page:
<script language = "JavaScript">
<!--
function runFlashFunction(){
do something here;
}
//-->
</script>
So can anyone assist me here.
Thanks for your time.
Reflex.
View Replies !
View Related
Thanks For Not Letting Flash Kick My Butt
Hi Forum,
Flash (Actionscripting) has been hurting my head really bad the last few months and wanted to thank all of you for the temporary relief to the pain.
If it wasn't for this forum, my computer would be in a thousand bits and I would have jumped off the nearest bridge.
Thanks,
Shawn
View Replies !
View Related
Thanks For Not Letting Flash Kick My Butt
Hi Forum,
Flash (Actionscripting) has been hurting my head really bad the last few months and wanted to thank all of you for the temporary relief to the pain.
If it wasn't for this forum, my computer would be in a thousand bits and I would have jumped off the nearest bridge.
Thanks,
Shawn
View Replies !
View Related
HitTest Penalty Kick Game
I stopped writing actionscript for about a year now as my job had nothing to do with it...but now I'd like to get back in for fun. I'd like to make a simple penalty kick game where when you move the keyboard that shows where you can kick it (i know how to do this)...And when you kick it have the ball be animated towards where you kick it (i don't know how to do this)...and if the goalkeeper is nearby, he will stop it (i don't know how to do this).
Any places I can start looking? Or any help you can give?
View Replies !
View Related
Kick A Function In Flash From HTML ?
Kick a function in flash from HTML ?
--------------------------------------------------------------------------------
Hi Peoples, here is the setup:
I have a .swf called master sitting on an .html page called master.html
In my .swf, I have an empty movie clip sitting on the stage called loader. I have two different movies in my library called movie1 and movie2 and they have been given linkages of "movie1" and "movie2". I also have two functions in the first and only frame of my movie. They look like this:
attachClip1 = function() {
_root.loader.attachMovie("movie1", "movie1", 10);
}
attachClip2 = function() {
_root.loader.attachMovie("movie2", "movie2", 10);
}
What I am trying to do is link to this .html page containing my .swf and run one of the above two functions. So the link I am trying to make could look something like this:
www.website.com/master.html?function=runFlashFunction
with something like this in the .html page:
<script language = "JavaScript">
<!--
function runFlashFunction(){
do something here;
}
//-->
</script>
So can anyone assist me here.
Thanks for your time.
Reflex.
View Replies !
View Related
Any Advice Complete Novice In Need Of A Good Kick Start
Heya
I've become quite attached to flash animation over the past few months and found myself with nothing to do in my evening's, so I've begun to think about learning how to create animation using Flash (and yep i haven't got a clue about anything, complete and utter new starter)
If anyone could suggest a good place to start, a good easy animation programme, quick to learn and user friendly and compatible with windows ME. (hopefully one with great end results)
I also don't know if you have to use a separate programme to add sound to Flash, any help at all would be greatly appreciated.
Thanks
View Replies !
View Related
[CS3] I Had A Dyslexic Bully Who Would Put "Me Kick" Signs On My Back.
so i bought this code (im an noob) so i could do this layered movement illusion, and I applied this code to one of the layers that has a looping movie with a motion guide, and every time it restarts its loop, the object moves 5 pixes or so away from the mouse. It gets quite annoying, and eventually it moves itself off the stage of my swf; to the point where i can no longer use the movie clip which i rely on for navigation
I have a feeling it has to do with the onEnterFrame
Is there any way to modify the code so it wont do that anymore?
Here is the code below:
Code:
//Set limits of image motion (note that negative values will change direction of image motion):
var y_limit:Number = 60;
var x_limit:Number = 90;
//Set speed of motion (large numbers = slower speed, if this is set to 1, motion will be instantaneous)
//DO NOT SET TO A VALUE LESS THAN 1.
var speed:Number = 15;
//THE FOLLOWING DOES NOT NEED TO BE MODIFIED:
//get original position:
var origx = this._x;
var origy = this._y;
onEnterFrame = function(){
//calculate goal coordinates based on mouse position:
goalx = origx - (((_parent._xmouse-Stage.width/2)*x_limit) / (Stage.width / 2));
goaly = origy - (((_parent._ymouse-Stage.height/2)*y_limit) / (Stage.height / 2));
//adjust position of image gradually:
this._x += (goalx - this._x)/speed;
this._y += (goaly - this._y)/speed;
}
View Replies !
View Related
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
Movie Clips In For Loop Onlydisplaying In 1st Loop
Hi there! I'm new at this so excuse if I'm being stupid.
I'm creating a game which I'm looping through an array and inside the loop I'm playing clips. The clips display only the first time the loop is being run. Here is the actionscript. PLEASE SOMEONE HELP ME... I'M DESPERATE!!!
code:
on (release) {
var myClips = new Array("Fletter", "Lletter", "Aletter", "Mletter", "Eletter");
var myClipsNewName = new Array("mov2", "mov3", "mov4", "mov5", "mov6");
var myClipsValue = new Array (10, 11, 12, 13, 14);
var cnt = 0;
for (var t = 0; t<4; t++) {
for (var i = 0; i if (cnt == -1) {
cnt = 0;
}
var temp = myClips[cnt];
attachMovie(myClips[cnt],myClipsNewName[cnt], myClipsValue[cnt]);
updateAfterEvent();
trace(myClips[cnt]);
if (i == Total-1) {
myClips.splice(cnt, 1);
myClipsNewName.splice(cnt,1);
myClipsValue.splice(cnt,1);
if (cnt == myClips.length) {
cnt = 0;
}
break;
}
cnt = cnt+1;
if (cnt == myClips.length) {
cnt = 0;
}
}
}
}
edit: jbum added as tags
View Replies !
View Related
Mp3 Sound Loop Bad. Wav Loop Good.
I have a soundloop which is a WAV file
and it works just fine when i loop it in flash
But when i convert it to an MP3 file...for osme weird reason theres a little less than 1 second pause when it starts again...you can tell its a loop...not smooth
But in WAV format its fine.
Its weird..ive used two different softwares to convert my wav file.
ive used Creative Wave Studio, Ive used a dedicated third party MP3-WAV convertor.
same results...the mp3 has bad looping.
any ideas?
View Replies !
View Related
[MX04] Loop Loop Whoops
Hi,
I know this might be really simple but I'm having a problem with my movie continuing to loop even though I've put the stop() function anywhere and everywhere I can think of. Basically, I have some mc's in Frame 1 which perform some calculations in AS. At the end of one of the calculations, I have _root.gotoAndStop(2) (which I'm assuming is telling the playhead to move on to the next frame in the main timeline).
I've put in key frames in the second frame for the same mc's to perform some different calculations which are dependent on variables from Frame 1's calculations. After running through the calculations, the movie won't stop looping and I can't figure out why.
Can anyone suggest a course of action? Thanks in advance.
View Replies !
View Related
Stop Loop And Replay Loop
Okay on my stage I have a start(MC) and a stop(MC) and a clear(MC) these will be used as buttons. I also have a dynamic text box that shows my output.
I am making it so when you click start it will start counting from 0 to whenever you hit the stop button, I have changed my fps to 1 so it doesn't crash my computer, And this is where I am running into trouble. Here is my code.
var myTimer = 0;
startBtn.onPress = function() {
this.onEnterFrame = function() {
myTimer = myTimer + 1;
//trace(myTimer);
this._parent.myTxt.text = myTimer;
}
}
stopBtn.onPress = function() {
trace(myTimer);
this.myTimer.onEnterFrame = stop();
}
I would also like it so when you hit start again it picks up where it left off.
Please any help would be greatly appreciated.
Thanks
T
View Replies !
View Related
Loop Within A Loop (creating 2 Columns)
Hello. I have the following loop, which works just fine:
ActionScript Code:
yGutter = 30;
xGutter = 28;
numPerRow = 1;
for (t = 0; t < vars.countEmployees; t++)
{
thumbCont.duplicateMovieClip("thumbCont" + t, 2000 + t);
this["thumbCont" + t]._y = thumbCont._y + yGutter * Math.floor(t / numPerRow);
this["thumbCont" + t]._x = thumbCont._x + xGutter * t - xGutter * numPerRow * Math.floor(t / numPerRow);
this["thumbCont" + t].tID = t;
this["thumbCont" + t].gotoAndStop(2);
mainCont.duplicateMovieClip("mainCont" + t, 3000 + t);
} // end of for
you can see this here:http://www.metapps.com/testing/index_email.html
I need to make 2 more columns, same as the first, with the rest of the info from the php file. Right now I have a "LIMIT 0,10" on the MYSQL request so there are only 10 rows. Ultimately there will be three rows with 30 employees.
How would I write this loop?
thanks
View Replies !
View Related
XML Nested Loop - Access The Loop Later... But How?
Hello all. I need help desperately, I'm very novice with this kinda stuff. Basically, I have data organized by date in an XML file. I'm trying to make a website application that will allow the user to click on a date (in a text field) to see another textfield populate with all the data under that particular date.
So far, all the information loads into the textboxes at the same time. How can I get it to only load information under a particular date when somebody clicks on that date?
Before I started this project, I was convinced I could do this by manipulating the [j] (see code below) in the myFunc2 function. Currently, it's set up to increment blank_mc._y by whatever value is returned by [j]. But for some reason this doesn't work. I feel that if I could atleas get this part to work - I could probably do the rest.
Any help is greatly appreciated. PS - I'm not sure I even need a nested loop for this...
AS code:
Code:
function loadXML(loaded) {
if (loaded) {
var nodes = this.firstChild;
for (j=0; j<nodes.childNodes.length; j++) {
groups = nodes.childNodes[j];
var info = groups.childNodes;
for (i=0; i<info.length; i++) {
var word2 = groups.childNodes[i].childNodes[0].firstChild.nodeValue;
var url2 = groups.childNodes[i].childNodes[1].firstChild.nodeValue;
_root.myText.htmlText +="<A HREF="asfunction:MyFunc,"+url2+" ">"+word2+"
</A>";
}
_root.myGroup.htmlText +="<A HREF="asfunction:MyFunc2,"+[j]+" ">"+groups.attributes.title+"
</A>";
}
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("links.xml");
function MyFunc2 (blarg) {
//trace (blarg);
//trace (blank_mc._y);
blank_mc._y = blarg;
}
function MyFunc (arg) {
loadMovie(arg, holder_mc);
};
XML Code:
Code:
<?xml version="1.0" ?>
<products>
<group1 title="January">
<item>
<one>foo</one>
<two>foo.swf</two>
</item>
<item>
<one>beans</one>
<two>beans.swf</two>
</item>
<item>
<one>spiders</one>
<two>spiders.swf</two>
</item>
</group1>
<group2 title="February">
<item>
<one>foo2</one>
<two>foo2.swf</two>
</item>
<item>
<one>beans2</one>
<two>beans2.swf</two>
</item>
<item>
<one>spiders2</one>
<two>spiders2.swf</two>
</item>
</group2>
</products>
View Replies !
View Related
GrRR Loop, Loop,loop
Hi ! I would like to know why when I goto publishing or otherwise. That when the program is run that the "loop" is always in the on mode. I have looked under preferences and I don't see it in there either. Can this thing be turned off somewhere by using scripts? Cause the last program I played with was supposed to "play and stop". It does work before the last frame is seen and then jumps over it when that script is activated. But then restarts the whole movie process all over again. But,now if I play the movie myself and I go and right click on the movie and turn off the loop it worksd just fine ... How do you turn that thing OFF????
ANYBODY KNOW??? HeLP!!
[Edited by Coke1bear on 12-26-2001 at 02:52 PM]
View Replies !
View Related
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!
View Replies !
View Related
Loop De Loop Need To Stop
Dear Helper People
I am trying to make a movie using the The Matrix Bitstream Effect
http://flashkit.com/tutorials/Specia...52/index.shtml
but I want to goandplay 10 times then stop.
Could you please tell me how I can set it so it goes through the frames 10 times then stops.
Well since I have you hear I would also like to ask.
I am also using the DOS Text Typer Effect
http://www.were-here.com/forum/tutor...sor/index.html
Why is it when I try to insert pictures to desplay on the screen, the pic moves along with the word.
How can I desplay it and not have it move.
-Thanks
View Replies !
View Related
MP3 Loop Script Won`t Loop
Hello guys ... I have this thing thats drivemin me nuts :s I am writing a MP3 player script but it won`t loop my sound ... and I have no idea whats wrong with it. ( I can stop the sound and play it but its not looping ) Maybe some1 could take a glance at it and give me hint woots wrong? Thank You
var mySound:Sound = new Sound();
mySound.loadSound("track1.mp3", true);
this.mc_stop.onRelease = function() {
curPlaybackPos = mySound.position;
mySound.stop();
}
this.mc_play.onRelease = function() {
mySound.start((curPlaybackPos/1000), 9999);
};
View Replies !
View Related
For Loop With Xml - Cant Understand The Loop
i have tried to keep this as simple as possible in order to demonstrate my confusion - i have looked at this for too long now and i really dont understand how this for loop works - sorry for the example length.
xml code:
<?xml version="1.0" encoding="iso-8859-1"?>
<root>
<node1>First node value</node1>
</root>
action script (ignoring the xml load part) :
function showNodes(node) {
trace("NODE = " + node);
for(var child = node.firstChild; child != null; child = child.nextSibling) {
trace("Node First Child = " + node.firstChild);
trace("child next sibling = " + child.nextSibling);
showNodes(child);
}
trace("xxxxxxxxxxxxxxxxxxxxxxxx " + node.nodeName + " " + node.nodeValue + " " + node.nodeType);
trace("yyyyyyyyyyyyyyyyyyyyyyyy " + child);
}
output:
NODE = <?xml version="1.0" encoding="iso-8859-1"?><root><node1>First node value</node1></root>
Node First Child = <root><node1>First node value</node1></root>
child next sibling = null
NODE = <root><node1>First node value</node1></root>
Node First Child = <node1>First node value</node1>
child next sibling = null
NODE = <node1>First node value</node1>
Node First Child = First node value
child next sibling = null
NODE = First node value
xxxxxxxxxxxxxxxxxxxxxxxx null First node value 3
yyyyyyyyyyyyyyyyyyyyyyyy null
xxxxxxxxxxxxxxxxxxxxxxxx node1 null 1
yyyyyyyyyyyyyyyyyyyyyyyy null
xxxxxxxxxxxxxxxxxxxxxxxx root null 1
yyyyyyyyyyyyyyyyyyyyyyyy null
xxxxxxxxxxxxxxxxxxxxxxxx null null 1
yyyyyyyyyyyyyyyyyyyyyyyy null
i can fully see how things work up until i hit the FOR LOOP EVALUATION:
child !=null
at that point the loop is broken and the trace statements with xxxxx and yyyy come into play but why is there 4 lots of x and y traces?
if the loop is broken and child = null which it does why does the statement carry on 4 more times - should it not just return?
i understand that the update part of the for loop will execute only at the end of the loop but this still does not show why it should carry on like this?
seriously grateful for any help as its driving me nuts
thank you very much in advance
View Replies !
View Related
Running A Loop Within A Loop
can this be done?
so that:
this is stage 1 of loop_a (this is stage 1 of the loop_b)
this is stage 1 of loop_a (this is stage 2 of the loop_b)
this is stage 1 of loop_a (this is stage 3 of the loop_b)
this is stage 2 of loop_a (this is stage 1 of the loop_b)
this is stage 2 of loop_a (this is stage 2 of the loop_b)
this is stage 2 of loop_a (this is stage 3 of the loop_b)
and so on...
iv attempted it and the loop within the other works, but the main one does not
View Replies !
View Related
For Loop In For Loop Problem
in the first frame of my movie i set an array called printframes. there i list three frame labels on my main time line that i want to print. on each of those frames resides a movie clip that has its own "printframes" array, again listing frames of its own time line that i want to print.
now, i have a button who's script is as follows:
ActionScript Code:
for(Array in _root.printframes){
T1 = _root.printframes[Array];
_root.gotoAndStop([T1]);
pj.addPage(_root, {xMin:0,xMax:1024,yMin:0,yMax:768},null);
trace("current frame in main time line is "+[T1]);
for(var prop in _root){
if (typeof _root[prop] == "movieclip"){
trace("movie found= "+ [prop]);
for(Array in _root[prop].printframes){;
T2 = _root[prop].printframes[Array];
trace("found secondary movie clip's printframe, adding page," + [T2]);
_root[prop].gotoAndStop([T2]);
pj.addPage(_root, {xMin:0,xMax:1024,yMin:0,yMax:768},null);
}
}
}
}
this script is working fine accept for on huge dilema...
the first time it finds a movie with its own "printframes" array it sees the array and does what i want it to do. how ever once it sees that secondary printframes array,
when it gets to a frame of the main timeline that has a new movie clip, it sees that movie but not its "printframes" array.
can anyone tell me why?
i have attached the actual fla and would really appreciate anyones help. i am guessing that after each it finds the secondary printframes array and does what i want it to do i have to clear the array somehow.. i don't know.. my brain is fried...
View Replies !
View Related
|