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




Cycling Images/text While Using Xml



Hey,
Recently I've been toying with actionscript and linking my flash to an xml doc.

The xml side is easy, I'm seeing it's the complex actioscript that throws all the problems. Anyway I managed to create a simple photo album (thumbnails, main image, titles), what I ultimately want to do isnt a million miles away, but is alot more complex, but I cant seem to find any tutorials pointing me in the right direction.

Id like to create a flash movie for lets say a business, with text, and pictures, using the alpha to fade in and out related images and bullet points regarding the businesses erm... business. Well I've actually done this bit already, what I want to do now, have every image and bullet point controllable from the xml document, while they still need to be able to cycle via alpha fading when viewed.

anyone?



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 06-28-2006, 12:48 PM


View Complete Forum Thread with Replies

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

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

PS. I'm using flash mx....

Random Cycling Of Images
Need some help taking a few images and making them cycle randomly at about 8 second intervals. I also would like to have the starting image be random each time you view the .swf . If someone could point me down the right track, I'd much appreciate it.

Thanks in advance.

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

Randomly Cycling Of Images....
May I noe if there is any flash example or anyone noe how to make images cycling very fast, then one of the images will zoom out for a while, then continue the procedure again but now display out another image.... Something like random letter cycling.... Thanx in advance....

Cycling Through Loaded External Images
I have a looping movie that is calling background images from an outside source. Right now I have it set to pull random images but what I need it to do is cycle through them instead. So instead of pulling images in randomly (newpic1.jpg, newpic4.jpg, newpic2.jpg) I want my movie to (ever time a loop is completed) bring in a image in a certain order (newpic1.jpg, newpic2.jpg, newpic3.jpg) and then once it hit the last image, lets say newpic4.jpg, know to go back to newpic1.jpg.

Here is my code for pulling the random images from outside Flash, hopefully all I'll need to do is edit it with a little help from you guys. Any ideas?

//
randomLoad = Math.ceil(Math.random() * 4);
myPic = "newPic" + randomLoad +".jpg";
trace ("newPic")
loadMovie(myPic, myClip);

Slide Show Effect - Cycling Images
Hi,

I am trying to create the slideshow effect found on the front page of this site www.studiomod.com

I think there must be a directory to store the images, and a swf file that cycles through them.

Is there a way to create a slideshow swf, and have a directory that is a reference for the pic? Having any number of pics, so the client can upload more or remove old pics?

Any help would be much appreciated.

Kind regards

Cycling Text Updated
Hey - I wanted to come up with a better way to cycle through text, like the way thats listed in the tutorials somewhere. I didn't want to have to duplicate movieclips, and I didn't want the letters to appear out of order. I think I came up with something pretty good, but I bet it can be improved upon...




ActionScript Code:
_root.onLoad = function() { text = "BEATBOX INDUSTRIES TWO THOUSAND SIX"; alphabet = "ABCDEFGHIJKLMNOPQRSTUVWQXYZ "; letters = new Array(); i = 0;}_root.onEnterFrame = function() { if (i < text.length) {  _root["letter"+i] == text.charAt(i) ? _root["letter"+i] = text.charAt(i) : _root["letter"+i] = alphabet.charAt(random(alphabet.length));  letters[i] = _root["letter"+i];  _root["letter"+i] == text.charAt(i) ? i++ : null;  _root["letter"+i] = alphabet.charAt(random(alphabet.length));  _root.text_txt.text = letters.join(""); }  if (Key.isDown(Key.CONTROL)) {  trace(text.length);  delete(letters);  letters = new Array();  text = text_2;  i = 0; }}

Cycling Through All Text Fields .
Is there a way to parse all the stage, and find all the textFields in it ?

I know it can be done pretty in AS3,
but i have no idea how to accomplish this with AS2.

Thanks!

Orizontal Cycling Text
Hi guys,

I'd like to set up a ticker box using a dynamic textfield.
I gust want to loop a text string starting from the right of the box and scrolling to the left side.
Since I'm not skilled in active script programming, can somebody give me an example to write the code?

I searched around but most of the text scroll topics are about vertical sliders...

Thx
Massimo

Text Cycling With External .txt File?
Does any one know how I'd alter the actionscript in the .fla attached so it would load text from an external .txt file? Yet still keep the same effect?

Cycling Text Files/ The Movieclip Button...
I'm having trouble figuring out how to cycle multiple text files through a single movieclip button. Meaning You click once get info1, click twice get info2 ,click three time and she's a lady...you get the drift.

I also have three movieclips for this button that I would ultimately like to cycle as well to show the user that the information attach to that particular button has changed. For example with info1 the button fades blue, with info2 the button fades green and so on. I have evening set up thus far to do it but I can't quite seem to find out how to bring it together.

I'm assuming I'll need to do an if/else but I am lost on how.

Thanks in advanced for any help or advice!!!!

Dustin

Text Field Cycling Through Random Letters And Numbers
I'm trying to get a text field rotate through random letters and numbers, for about 5 cycles each character, then I would like the text filed to resolve into "my chosen text" - I can do it with a different text field for each letter, BUT I want to do this with only one text field for each phrase.

[F8] Cycling?
Hello there.

Can some one help me with this one. The button on the bottom (red with a "V") is supposed to cycle through the different pages.

It works for one cycle and then goes crazy. I can't figure out why. I know this file isn't set up all that great but I've inherited it and need to make it work the way it is.

The FLA is at:
http://rbelotte.net/fla/v_b.fla

any ideas?

Thanks

Cycling Between Two Different Scripts
Hi, I was wondering if its possible to cycle between two different scripts uppon button press.
Like when you press my_button it traces "1", when you press it again it traces "2", press again it traces "1" and so on...

My code looks like this:
code:
pressed = 1;
_root.my_button.onPress = function() {
if (pressed == "1") {
trace("1");
pressed = "2";
}
if (pressed == "2") {
_root.my_button.onPress= function() {
pressed = "1";
trace("2");
};
}
};

But it doesn't work. When I press the button the first time it traces "1" then everytime I press it again it only traces "2".
What am I doing wrong?

Any help is greatly appreciated,
A

Cycling Through Symbols
I have a combo box on my flash movie which allows the user to select one of it's listed values which then makes visible the corresponding symbol on the stage. So, if I click 'Tree' from the combo box list it unhides the tree picture. This uses the ActionScript:

on(change){
if (selectedItem.label == "Tree") {
this._parent.tree._visible = true;
this._parent.house._visible = false;

}

This shows the Tree symbol and makes sure the House symbol is hidden. This works fine but I can't help but feel that it would look better if I had a button that cycled through the available images so the user doesn't have to choose from the combo box. How can I get a button to do this?

Color Cycling
Hello, I seem to have a glitch with the following code, it works for the 1st frame, but then stays black. Can you guys give me a hand?





R1 = 0;
R2 = 0;
G1 = 0;
G2 = 0;
B1 = 0;
B2 = 0;
onEnterFrame = function(){
RGB();
DRAW();
}
function DRAW(){
clear();
beginFill("0x"+R1+R2+G1+G2+B1+B2);
lineTo(550,0);
lineTo(550,400);
lineTo(0,400);
lineTo(0,0);
endFill();
}
function RGB(){
if(R1 == 0){
HEX();
R1 = val;
}else{
R1 --;
}
if(R2 == 0){
HEX();
R2 = val;
}else{
R2 --;
}
if(G1 == 0){
HEX();
G1 = val;
}else{
G1 --;
}
if(G2 == 0){
HEX();
G2 = val;
}else{
G2 --;
}
if(B1 == 0){
HEX();
B1 = val;
}else{
B1 --;
}
if(B2 == 0){
HEX();
B2 = val;
}else{
B2--;
}
}
function HEX(){
val = random(16);
if(val == 10){
val = "A";
}else if(val == 11){
val = "B";
}else if(val == 12){
val = "C";
}else if(val == 13){
val = "D";
}else if(val == 14){
val = "E";
}else if(val == 15){
val = "F";
}
}

Cycling Colors Rbg
Hi there,

i was wondering if someone could help advise me to the best approach for this problem.

I have an interactive thing thast leaves a lind trail but id like to cycle the colours depending on the percetage loaded.

How can i start from

r:0
b:0
g:0

and ease through the colour spectrum until

r:255;
b:255;
g:255;

I tired a few things but i seem to just be getting grayscale.

Apprecite your time.

Ronson.

[MX] Cycling Advertisements.
Hello all.

I've been having difficulty searching for this answer as my keywords always bring up another type of advertisement solution.

What I am looking to do is this:
Have a advertisement on a webstore that fades to another advertisement, and then another, and so forth, until it loops back. Each ad has its own hyperlink. Somewhere on the space is a set of page numbers showing which ad page is currently displayed. The user can jump straight to an Ad or let it continue to cycle through the repeating set of ads. The Ad is not a "Banner" but rather a custom sized area (iframe, table, whatever) of the webpage.
Sometimes I see it on www.target.com's homepage (this week they took it off)
Currently there is a perfect example on the following page:
www.homedepot.com.

Is there a template available for this solution? I am too much of a newbie to Flash to figure this out in a short time.

Any help, or guidance, is much appreciated.

TIA,
Trode

Cycling Through An Array
Hi folks, novice with arrays here and need some help. I have an array that looks like this

var Actions = new Array();
Actions[0] = ["1", "1a", "1b", "1c"];
Actions[1] = ["2", "2a", "2b", "2c", "2d", "2e"];
Actions[2] = ["3"];
Actions[3] = ["4"];
Actions[4] = ["5"];
Actions[5] = ["6"];


I have set a variable that captures which item in my array is currently being displayed called "where"


Now what I need is a forward and back button that will cycle through the array depending what "where" is

something like gotoAndStop(where+1)

I just don't know the syntax for doing this with arrays

Rollover Keeps Cycling
I have a large button area that needs to have the rollout function to work. But nothing I try is doing the trick.

The button dualWSarea works just fine with a mouseover. But I want the "pop-up" to disappear when the mouse moves off the button. I can not get the rollout to work.

I tried embedding it into the button but the background shows through during a true mouse over.

HELP

I can not get the attachment file to attach to this post. If you would like to straighten me out, please IM or email me....

tony

For Loop Not Cycling Thru For Xml
hello all, i've got a 'for loop' attaching a movieclip and for each iteration i'm also creating a textfield. the loop is creating the correct number of MC's and the correct number of textfields (just one per) in those MC's. my problems is getting the xml data into those txtfields. the data only shows up in the first textfield...all the others(the number varies) are 'undefined'....



Code:

for (var z = 0; z < bldgFacts; z++){ // start looping through xml

var item_mc = _root.swaps.facts_holder.attachMovie("facts","facts"+item_count, item_count);
item_mc._y = item_count * item_spacing;

item_mc.createTextField("factstxt"+z,1,0,0,378,45);
item_mc["factstxt"+z].text = seasArts.firstChild.childNodes[n].childNodes[2].firstChild.childNodes[z].nodeValue;
item_mc["factstxt"+z].setTextFormat(facts);

item_count++;
trace(item_mc["factstxt"+z])

here is a snippet of my xml file...



Code:
<item>
<title>The Hardeman House</title>
<btn>btn1</btn>
<bldg_info>
<fact_one>1111</fact_one> <--- the data i'm trying to access!
<fact_two>2222</fact_two> <--- the data i'm trying to access!
<fact_three>3333</fact_three> <--- the data i'm trying to access!
<fact_four>4444</fact_four> <--- the data i'm trying to access!
</bldg_info>
<photo>.../photos/hardemanhouse.jpg</photo>
<movie_clip>.../ropes_course.flv</movie_clip>
</item>
any ideas? it seems like i've traced everything and it all looks correct, but obviously it ain't thanks!

Letter Cycling
I am using the script from the tut in Kirupa about how to letter cycle a word.

http://www.kirupa.com/developer/flas...ercycling2.htm

I have it working but i am trying to create more than one word in seperate text boxes. I have changed MC names and text boxes, but it seems to only cycle in the first box. I even added dummy letters, which works but i am sure this is not the best way.

Can anyone give me a suggestion on how i would approach this problem? Thanks in advance... here is the script:

onClipEvent (load) {
if (_name == "main") {
name = "PORTFOLIO";
for (x=0; x<name.length; ++x) {
this.duplicateMovieClip("let"+x, x);
_parent["let"+x]._x += x*10;
_parent["let"+x].endLetter = name.charAt(x);
}
_root.alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
_alpha = 0;
} else {
cycle = true;
}
}
onClipEvent (enterFrame) {
if (cycle) {
if (this.letter == endLetter) {
++_root.count;
cycle = false;
} else {
this.letter = _root.alphabet.charAt(random(_root.alphabet.length ));
}
}
}

AS2 Help - Cycling Through Movies
I have a pretty simple flash project, it's one main movie and then 3 smaller movies that are externally loaded into the main movie when a button is clicked. Also the same small movie also loads into the main movie file when the page is loaded.

Well I would like to add some funcationally to it, so when the page loads the main movie starts to cycle through the other movies regardless of if the button has been clicked or not. I've seen a bunch of other site out there have something like this but have been able to track down a tutorial on how to go about doing it. Does anyone out there know a good place to start with this or have some pointers on what to do?

Cycling Through Variables
I am loading a number of variables from a text file:
news1
news2
news3
...

I want to cycle through them to manipulate their values until I get to the last defined variable (so I can put as many variables in the text file as I please.  I've tried using a for loop, but I think I've got the wrong syntax:

for (i = 1; ["news" + i] != undefined; i = i + 1 ){
     <manipulation steps here>
}

Any ideas?

Thanks!
drewson

Movieclip Cycling Twice
Hi! Brothers and Sister's!

k, silly question! Forgive me its been 56 hours of work.

For the life of me I can't figure out how to cycle a movieclip only twice "script-wise".

I figured without copying and pasting my frames and increasing file size, why not just tell AS to play the movieclip twice and call it a day, and maybe grab a sub or something.

Any ideas, tips, key words. It's prolly obvious but I'm loosin' it, hehe

Thx all.

Cycling Through Multiple Mp3
following this great tut i was able to load a dynamic mp3.. so i created a vcr type of gui..

my problem is how can i make the "next song" button be able to cycle through 5 song?

do i just use "onClick" next frame..and on that frame..do action to load the song?..

or is there a better way..


thx..

Cycling Through An Array
I am using addListeners to detect the left/right key strokes to cycle through the variables of an array. The problem I am encountering is that when it hits the end of the array, I want it to revert to the first item. As well, if they are on the first item I want it to go to the last item.

Code:

//Listens for the left/right keystrokes
listen = new Object();
listen.onKeyDown = function() {
   if (Key.getCode() == Key.LEFT) {
      prevPromo();
      trace("PREVIOUS");
   } else if (Key.getCode() == Key.RIGHT) {
      nextPromo();
      trace("NEXT");      
   }
};
Key.addListener(listen);

//this value controls the cycle through
p = 0;

//This rotates the array to the next item when the right arrow key is pressed
//Currently it does cycle to the first item, but it causes an error at the last
//item because it can't find the URL - hence the undefined statement

function nextPromo() {
   if (p<(promoTotal)) {
      p++;
      trace(promoNodePath[p]);
      promoHolderClip.loadMovie(promoNodePath[p]);
      promoHolderClip._x = promoNodePathX[p];
      promoHolderClip._y = promoNodePathY[p];      
   } if (p==(promoTotal)){
      promoHolderClip.loadMovie(promoNodePath[0]);
      p=0;
      
   }else if (promoNodePath[p] == undefined){
      promoHolderClip.loadMovie(promoNodePath[0]);
      p=0;
   }
}

//cycles through the promos till the first item
function prevPromo() {
   if (p>0) {
      p--;
      promoHolderClip.loadMovie(promoNodePath[p]);
      promoHolderClip._x = promoNodePathX[p];
      promoHolderClip._y = promoNodePathY[p];      
   }
}

//Loads the first clip in the array.
function runApplication(){   
   _root.createEmptyMovieClip("promoHolderClip",10+p);
   promoHolderClip.loadMovie(promoNodePath[p]);
   promoHolderClip._x = promoNodePathX[p];
   promoHolderClip._y = promoNodePathY[p];
}


Any suggestions would be helpful. Thanks.

Cycling Through LoadMovies
I have a pretty simple flash project, it's one main movie and then 3 smaller movies that are externally loaded into the main movie when a button is clicked. Also the same small movie also loads into the main movie file when the page is loaded.

Well I would like to add some funcationally to it, so when the page loads the main movie starts to cycle, like each movie is seen for 30 seconds, through the other movies regardless of if the button has been clicked or not. But if one of the buttons were clicked the cycling would stop altogether. I've seen a bunch of other site out there have something like this but have been able to track down a tutorial on how to go about doing it. Does anyone out there know a good place to start with this or have some pointers on what to do?

Cycling Through Movies, Question?
Very new to flash!
Lets say I have 4 .swfs(movie1.swf,movie2.swf,and so on) that I want to load into a target
clip, and I have two buttons, basically
"Forward" and "Back" buttons,
I want to be able to press "Forward" then load
movie1.swf then press forward again, and load movie2.swf, and have the same power w/ the "Back" button! I am assuming this has something to do w/ variables, but like I said I very new to all of this.
I DO want each movie to replace the previous, but from what I read here that happens automatically when you load into a target.....right???
Also I would like the cycle to loop, 1-2-3-4-1-2-3-4
In other words when you reach movie4.swf and press forward again, you come back to movie1.swf.

I'm using Flash MX.
Any help would be greatly appreciated!
Thanks alot!!

[F8] Cycling Random Numbers
Hi there,

I'm new to Flash and I was wondering if anyone could help me.

What I'm trying to do is create something that will cycle through numbers 1-9 randomly, then stop on a set number after a set amount of time.

I've seen this done with random letters, but I don't know enough about the script to work out if it will work with numbers.

If anyone could help, it'd be much appreciated.

Thanks in advance,

/Rorx

[F8] Why Is My Button Cycling Through Its States?
I've been away from Flash for a while and I've not used buttons much -- I tend to use movie clips for everything...so much for excuses.

What OBVIOUS and basic issue am I missing here? I just tried to follow a simple online video tutorial about using buttons to put an image into a movie clip. I decided to make it a little nicer by adding rollover and down button states. When I do that, though, the button continuously runs through its states!

It's a one frame movie with some simple script in the timeline frame, but the button cycles even when I remove all of the scripting.

Thanks for helping,
A. Moron

How Do I Make A Cycling Timer?
hi guys!


im needing some help with code.

im trying to make a movieclip automatically load different swf files at certain times of the week. for eg: tusday, 5pm, loadMovie, frame1.swf

any ideas?
its kida urgent.

cheers!

Cycling Through Folder Contents
Hi all,

i have a little question.

i am making the flash header picture reel on our clan forum http://www.dreamx3me.be/inf

but i'm not completely happy with it right now.

What happens is i first load a text file with the names of all the pictures, i then build an array with the picturenames, and then randomly go through the array and load the chosen picture.

But i'm getting too a point that i have too many pictures (about 90 now) and i want to simplify because it's getting a bit slower and i want to add more in the future...

is there a way to do this better? for example can i cycle through my pictures folder from within flash?

as i'm writing this i guess i could name the pictures: 1.gif, 2.gif, 3.gif eliminating the need to load the names into an array.. but maybe you have a better suggestion?

thx!

greetz Spike

Cycling Letters Prototype
I am have trouble converting the method for cycling letters in textfields found here http://www.kirupa.com/developer/flas...ercycling2.htm into a reusable prototype in as 2.0. Can anybody help?

Cycling With Next And Previous Buttons
I'm pretty new to action script and have pieced together the bellow code from tutorials and other whatnots. At the bottom you'll see my 'forward/backward' script that cycles through my array. My question is how do I put my index specific buttons in the down state while 'forward/backward' buttons do their magic?









Attach Code

Movieclip.prototype.scrollme = function(xPos) {
//this gets the current X position of the clip calling the function
cX = this._x;
//this works out the distance between its current X position and where it has to go
difX = cX-xPos;
//this sets the new X position of the clip
//the clip moves 1/5th of the total distance every frame
this._x = cX-(difX/5);
};
stop();
//variable starting value
arrayIndex = 1;
//timeline stopping postions
timelineXpos = new Array(0, 0, -760, -1520, 305);
//scrolling animation
timeline.onEnterFrame = function() {
this.scrollme(timelineXpos[arrayIndex]);
};
//buttons that scroll the timeline to specific x positions
//but1
controller_mc.but1.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but1.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but1.onRelease = function() {
arrayIndex = 1;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//but2
controller_mc.but2.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but2.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but2.onRelease = function() {
arrayIndex = 2;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//but3
//
controller_mc.but3.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but3.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but3.onRelease = function() {
arrayIndex = 3;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//
//timeline forward and backward buttons
controller_mc.goForward.onRelease = function() {
if (arrayIndex<3) {
arrayIndex++;
}
};
controller_mc.goBack.onRelease = function() {
if (arrayIndex>1) {
arrayIndex--;
}
};

Cycling With Next And Previous Buttons
I'm pretty new to action script and have pieced together the bellow code from tutorials and other whatnots. At the bottom you'll see my 'forward/backward' script that cycles through my array. My question is how do I put my index specific buttons in the down state while 'forward/backward' buttons do their magic?









Attach Code

Movieclip.prototype.scrollme = function(xPos) {
//this gets the current X position of the clip calling the function
cX = this._x;
//this works out the distance between its current X position and where it has to go
difX = cX-xPos;
//this sets the new X position of the clip
//the clip moves 1/5th of the total distance every frame
this._x = cX-(difX/5);
};
stop();
//variable starting value
arrayIndex = 1;
//timeline stopping postions
timelineXpos = new Array(0, 0, -760, -1520, 305);
//scrolling animation
timeline.onEnterFrame = function() {
this.scrollme(timelineXpos[arrayIndex]);
};
//buttons that scroll the timeline to specific x positions
//but1
controller_mc.but1.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but1.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but1.onRelease = function() {
arrayIndex = 1;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//but2
controller_mc.but2.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but2.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but2.onRelease = function() {
arrayIndex = 2;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//but3
//
controller_mc.but3.onRollOver = function() {
this.frameHold = this._currentframe;
this.gotoAndStop("over");
};
controller_mc.but3.onRollOut = function() {
this.gotoAndStop(this.frameHold);
};
controller_mc.but3.onRelease = function() {
arrayIndex = 3;
for (var mc in this._parent) {
var thisHold = this;
if ((this._parent[mc] == thisHold) && (this._parent[mc]._name.indexOf("but") != -1)) {
this._parent[mc].gotoAndStop("on");
} else {
this._parent[mc].gotoAndStop("off");
}
}
this.frameHold = this._currentframe;
};
//
//timeline forward and backward buttons
controller_mc.goForward.onRelease = function() {
if (arrayIndex<3) {
arrayIndex++;
}
};
controller_mc.goBack.onRelease = function() {
if (arrayIndex>1) {
arrayIndex--;
}
};

Cycling Through An Array Three At A Time
If I wanted to to cycle through an array that looked like this:

Array("Red", "Blue", "orange", "green", "Silver", "Black", "Yellow", "Peach")

how would my code look if I wanted to only display three at a time. what would the code look like for a next and a previous button to see the next three and the previous three?

Problem With Cycling Through Variable
i am loading in external images through a xml file, and trying to navigate them by using forward and backwards buttons, but i can figure out how to go from 1 to 4 backwards, when i try, it either doesnt work or the counter will simply not go lower/higher then 4. please help me, do you have any ideas.









Attach Code

imgLoad();

var interval = 8000; //Her ændrer du intervallet

var Interval = setInterval(imgLoad, interval);


//Billeder
var i:Number;
i=0;
picText.text = (i+1);
var e:Number;
e=0;
var billedTal;


function imgLoad(){
picText.text = (i+1);
var myPhoto:XML = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success:Boolean) {
var numimages = this.firstChild.childNodes.length;
billedTal = numimages;
this.picHolder = this.firstChild.childNodes[i];
linkURL = this.picHolder.attributes.link;
filenameURL = this.picHolder.attributes.src;
this.thumbHolder = holder.createEmptyMovieClip("thumbnail"+e, e+1);
this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);

this.thumbLoader.loadMovie(filenameURL);
//Tween
this.thumbLoader.onEnterFrame = function(){
import mx.transitions.Tween;
var mytw:Tween = new Tween(this, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 30, false);//30 er det antal frames der går når billedet fader
};

this.thumbHolder.title = this.picHolder.attributes.link;
this.thumbHolder.onRelease = function(){
getURL(this.title, "_parent");
};//onRelease

i++;
e++;
//trace(e);
//trace(i);
if(i >= numimages){
_root.i=0;
};

};
myPhoto.load("xmlphoto.xml");//stien på xml filen
//trace(i);
};
a
btnF.onRelease = function(){
imgLoad();

};
btnP.onRelease = function(){
i--;
i--;
if(i < 0){
i = billedTal - 1;
};
imgLoad();
};

Cycling Tint Of Mc With Key Press
Anyone have any help as to how to cycle through three different tints of a movie clip with the left and right keys? Thanks.

Randomly Cycling Through XML Gallery
Hi all,

I've got an interesting one for ya. How do I make a random XML auto gallery. The actionscript is for my auto gallery, which loads and changes every 15 seconds. How do I make it so that it loads from the XML file randomly?!

Any help would be much appreciated! Thanks guys and gals.

See code below...


Code:
// set up variable and constants
var pathToPics = new String();
var pArray = new Array();
var tArray = new Array();
var fadeSpeed = 20;
var pIndex = 0;



// change photo prototype function
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};



// fade pictures out prototype
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};



// load photo prototype
MovieClip.prototype.loadPhoto = function() {
var p = this.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};



// preloader function for pictures
MovieClip.prototype.loadMeter = function() {
var l, t, per;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
per = Math.round((l/t)*100);
loadBar._visible = 1;
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
loadBar._visible = 0;
} else {
loadBar._xscale = per;
}
};



// fade in pictures prototype
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};



// set timing for the photo change
setInterval(this,"changePhoto", 15000, 1)



// set up XML
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
pathToPics = gallery.attributes.path;
for (var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes[i].attributes.title);
pArray.push(gallery.childNodes[i].attributes.source);
}
loadPhoto();
} else {
title_txt.text = "Error!";
}
};



// XML gallery file
gallery_xml.load("autogallery.xml");
In addition, is there a way to stop possible recurrsion? This would be excellent to stop the same image being called twice in a row...

Ads.

Cycling Through Embedded Fonts
Hello all,

I'm currently working on a project for a client which requires about 25 fonts to be embedded within the SWF. The project calls for text to be entered in via input text and displayed in a chosen font in a dynamic text field.

I am having problems selecting the embedded fonts via actionscript. Currently my script appends an asterisk to the font name that is taken from a combo box component. I embedded the fonts in the library, and set embedFonts = true for the dynamic field.

I've never had to deal with this many different fonts at once as well as having the text fields dynamic. Anyone have any ideas?

Here's a link to what it looks like currently: http://www.pallidimage.com/clients/adhesive

Thanks,

Blake

Color Cycling Through Scripting
I would like to change the color of an object through a rainbow of colors. For example, the animation loads and the background object is blue within a minute or so it's purple, then red, then orange, yellow, green, and back to blue. basically r, g, and b should cycle through their values on a timer.

I want to be able to control the speed of the cycling so i can slow it down or speed it up

it would be awesome to have an array of hex values that get converted to RGB and then cycled through so the number of colors it cycles through as well as the order could be controlled.

i'm sure this can be done, and i have a basic theory of how to do it but i wonder if anyone out there has seen this done and could get me started w/ an example.

i'm working on this currently, so i'll post if i finish before someone posts the answer

thanks in advance for your help

Cycling Through Movie Instances?
Hi all,

I am currently working a flash map which feature over 600 plots, which i need to be able to cycle through and control via actionscripting.

The position of the movieclips will generally not move and remain in position to its relevent parent movieclip, ~At best i wish to assign properties to each movie name, or cycle trhough each instance name.
(e.g a loop that adds a incremental number to the instance name and lets me change colour/alpha of the object)

I have a good understanding of actionscript 2.0 and have searched the web and books for the correct direction. Just wondered if you guys could point me in the right direction?

Do I do this with OOP, i.e assigning objects to each plot point:

Plot 120: Property type: Escher Size: 3 bedroom etc

Or with arrays? or a more simpler way?

Desperate for some guidence on this guys.

Random Cycling Letters
Just wondering if anyone knows how its done.
For example the word "Welcome" From left to right random letters cycle through till the get the right one which reveals the word "Welcome".

example attach.

site examples:
http://www.mocafusion.com/
http://www.tronicstudio.com/media/about/about.swf (click mission btn)

XML Confusion: Cycling Through Children
Hi, I am rather new to Flash and XML...

I have an XML file that looks something like this:


Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<calc-growth>

<state name="california">
<location city="san_francisco">
<telephone>(555) 123-4567</telephone>
<telephone2>(555) 123-456203456</telephone2>
<fax>(555) 123-4569</fax>
<address1>1 Main St.</address1>
<address2>nothing</address2>
<email>cali email</email>
</location>
</state>

<state name="colorado">
<location city="fort_collins">
<telephone>(555) 123-4567</telephone>
<telephone2>(555) 123-4568</telephone2>
<fax>(555) 123-4569</fax>
<address1>1 Main St.</address1>
<address2></address2>
<email></email>
</location>

<location city="boulder">
<telephone>(555) 123-4567</telephone>
<telephone2>(555) 123-4568</telephone2>
<fax>(555) 123-4569</fax>
<address1>1 Main St.</address1>
<address2></address2>
<email></email>
</location>

<location city="denver">
<telephone>(555) 123-4567</telephone>
<telephone2>(555) 123-4569</telephone2>
<fax>(555) 123-4569</fax>
<address1>1 Main St.</address1>
<address2></address2>
<email></email>
</location>
</state>

<state name="connecticut">
<location city="hartford">
<telephone>(555) 123-4567</telephone>
<telephone2>(555) 123-4568</telephone2>
<fax>(555) 123-4569</fax>
<address1>1 Main St.</address1>
<address2></address2>
<email></email>
</location>
</state>
I have already been able to make an array based off of the names of the states:


ActionScript Code:
xml.onLoad = function(ok) {    avAll = this.firstChild.childNodes;    avStates = new Array();    for (var i = 0; i<avAll.length; i++) {        avStates.push(avAll[i].attributes.name);    }}


BUT, what I would like to do is create a multi-dimensional array with the state name and it's cities.

So the array should be formatted like this:


ActionScript Code:
trace(avStates[0][0]); //returns san_franciscotrace(avStates[1][0]); //returns fort_collinstrace(avStates[1][0]); //returns bouldertrace(avStates[1].length); //returns 3  


Im sure its possible but Ive been trying and trying for hours to no avail. I dont know if I maybe formatted the XML file wrong for this type of thing?

HELP PLEASE!!

Cycling Through All Textfields In Movie
Hey everyone,

What I am basically trying to accomplish, is being able to cycle through all textfields in my movie using a for loop or otherwise, that changes the text based on language selected. I have heard of using Locale for this, but am not sure of a way to change all strings simultaneously.

This needs to be a (seemingly) simultaneous event.

So 1) can someone help me with the for loop part of it? I am having trouble figuring out how to cycle through textfields using something like
Code:
for each (var str:Textfield in root){
...
}
2) if anyone can offer another suggestion to accomplish this that would be helpful.

Thanks!

Justin

Random Letter Cycling - Again
I'd like to reuse this old code, but need to have it rewritten for the main timeline. I can't seem to get it right. Anyone else? You need to create a textfield and give it the variable name of "letter" (No instance name is needed). Then convert the textfield to a movieclip named "my_mc" and drag that onto the stage. Place the following code on it:


Code:
onClipEvent (load) {
if (_name == "my_mc") {
name = "BUSHANDCHENEY";
for (x=0; x<name.length; ++x) {
this.duplicateMovieClip("let"+x, x);
_parent["let"+x]._x += x*15;
_parent["let"+x].endLetter = name.charAt(x);
}
_root.alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
_alpha = 0;
} else {
cycle = true;
}
}
onClipEvent (enterFrame) {
if (cycle) {
if (this.letter == endLetter) {
++_root.count;
cycle = false;
} else {
this.letter = _root.alphabet.charAt(random(_root.alphabet.length));
}
}
}
Thanks for any help.

Random Letter Cycling
Hi,

I'm working on a project which involves random letter cycling, without being able to adapt the available codes into as3

like this: http://proto.layer51.com/d.aspx?f=1448

or this one:

import flash.utils.setInterval;

myArray:Array = new Array();
var k:int = 1;
myArray.push("hello");
var finterval:uint;
var counter:Number;
var displaytext:TextField=new TextField();
var displayLength:Number = displaytext.length;
var myinterval:uint;
var b:String;

function startoff(displaytext:TextField):void {
k++;
if (k = myArray.length) {
k = 1;
}

myinterval = setInterval(messup, 20);
clearInterval(finterval);
}
function messup(event:Event):void {
counter++;

mystring.text = "";
for (i=0; i<displayLength; i++) {
b =displaytext.substr(Math.round().Math.floor()*i, 1);
mystring.appendText(b);
}
if (counter>10) {
counter = 0;
clearInterval(myinterval);
myString.text = displaytext.text;
finterval = setInterval(startoff, 5000, myArray[k]);
}
}
finterval = setInterval(startoff, 1000, myArray[k]);
----------------

does anyone know if there is any available versions of this for as3, or how to migrate?

thank you.

Cycling Through Displaylist Recursivly
First, let me take this line to say hello, since I new around here after beeing directed to this forum by my actionscript teacher and classmates.
Hello there!
I am kinda new to Actionscript and while working on my first project I struggle with the following:
What I want to do is just cycling through the display list, check if the instance name of an MovieClip matches the filter String and then returns an Array of those MC's.

The code goes like this:


PHP Code:



var buttonArray:Array = makeArray(this, "button");  // get buttons from DisplayList

function makeArray(mc:MovieClip, filter:String) {
// Cycle through the display list, return an array of all MovieClips matching the filter string
    var array:Array = new Array();

    for(var i:int = 0; i < mc.numChildren; i++) {
        trace(mc.getChildAt(i).name.substring(0, filter.length)); //test
        if(mc is MovieClip)
        {
            if(mc.getChildAt(i).name.substring(0, filter.length) == filter) {
            /** Tests if childs name includes button. cant figure out why i must check for 
                7 character while only searching for six. Maybe they start String.substring 
                with 1 in AS, unlike Java? **/
            
                array.push(mc.getChildAt(i));
            }
            else if(mc.getChildAt(i).numChildren > 0) {
                array.concat(makeArray(mc.getChildAt(i), filter));
            }
        }
        return array;
    }





Compiletime Errors:
1119: Access of possibly undefined property numChildren through a reference with static type flash.displayisplayObject. @ else if(mc.getChildAt(i).numChildren > 0) {


1118: Implicit coercion of a value with static type flash.displayisplayObject to a possibly unrelated type flash.display:MovieClip. @ array.concat(makeArray(mc.getChildAt(i), filter));

I kinda dont get the reason for this. If I test the Displayobject to be a MovieClip, explicitly, why do I reference a possibly undefined property? I thought about the possibility that the Child of an MC might not be an instance of MC, like a StaticText object or whatever, but since i check the instance to be an MC in the first place, I can't figure out the problem anymore.

Regards,
Zoimt

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