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




How To Cycle Through A List Of Vars From Php/mysql



Hello everyone ive been stumbling with this for days and it keeps returning so i need to find away to fix it. i have a mysql db and php im very good with php and mysql and im learning actionscript right now. i have flash 8 pro. im loading a list of testimonials from the database and i need them to print out in a flash document that i have created, it works great when i just send one variable but i need it to dynamically cycle through all the variables untill there are no more testimonials. so in php i have
Code:
<?PHPrequire_once('conn.php'); // connects to db $getmsgs = "select * from messages where type='testimonial';";$gomsges =@mysql_query($getmsgs);$i=0;while ($msgrow = mysql_fetch_array($gomsges)){if($i!=0){echo"&";}echo "testiname$i=$msgrow[4]&testimsg$i=$msgrow[2]";$i++;}mysql_close($link);?>
as you can see i concated the incrementing i to the names so that i can distiguesh between them then in flash i load them into a array to kindof weakin my workload here is the actionscript the if statement is just to put the & symbol into the first variable but only if its not the first variable ... pay it no mind
Code:
myVars = new LoadVars();myVars.load("http://www.harryrice.zonemikel.com/testiflash.php"); myVars.onLoad = function( ){ trace("variables loaded");}myVars.onLoad = function( success ){ if(success){ testi.textColor = 0x000000;var testimonial:Array = [myVars.testiname0,myVars.testimsg0,myVars.testiname1,myVars.testimsg1];i=0;while (i<4){testi.text +="From:" +testimonial[i] +"";i++;testi.text +=+ testimonial[i] +"";i++;} } else { trace("Error loading page"); }}
I have had similar problems with php and i solved them by having $variable3 =variable2$variable1 and then i would incrament to give me variable1,variable2,variable3 but i cant just tag the i onto the end of a vairable in flash to get var1 var2 and var3 because if i do something like while(i<3){vari; i++} it has no way to disinguish the i from the variable.. as you can see it prints out the first two testimonials that are loaded into the array (myvars.testiname0 and myvars.testimsg0 and one) which correspond to the first two testimonials but is there any way i can load the variables from php and have it print them all out till there are no more ? i tried doing it without appending the incrementing i to each name in php but then it just prints out the last message twice ? I need it to print out every message till there are no more.thanks in advance the only other alternative i have is to load like all the way up to myvars.testimsg10 into that array and loop through them and then only print out to the textfeild if it is not undefined which would be a pain and not very dynamic. this is a stepping stone for a similar problem that i have with a flash chat room so when i figure it out the rest will be gravy. Thanks and your welcome to look at the page and click testimonials to see the flash movie ... i think testi is a bad variable name but it seemed good at the time



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 05-29-2006, 04:19 AM


View Complete Forum Thread with Replies

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

Vars From MySQL To My SWF
Okay, it's been a while since I've asked a question making me look rediculous...So here it goes:

If I wanted to load stuff from a MySQL database into my swf, how would I do that??

Thanks in advance - Ruben

Getting Vars From MySQL To Flash
I have a MySQL database from where i need som info. presented in flash.

Here's my PHP code. E.g. i need the info(vars) of $europePercentage to be presented in my movieclip in flash.

Can anyone help me with the AS (flash) code to make this possible?

Hope someone can help

/Kafir

<?php

// start the session
session_start();

include ($_SERVER["DOCUMENT_ROOT"] . "/include.php");
include_once ($GLOBALS['homeDir'] . "common/functions.php");

// check whether the user is logged in or not
//checkUserLogin();

// initalize vars
$europePercentage = $northAmericaPercentage = $southAmericaPercentage = $asiaPercentage = $africaPercentage = $australiaPercentage = 0;

// get each of the countries and set them
$sql = "SELECT cID AS id, cTitle AS title FROM tblCountry UNION SELECT coID AS id, coTitle AS title FROM tblContinent";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
$$myRow['title'] = $myRow['id'];
}

// get the total number of residences
$sql = "SELECT COUNT(rID) AS cnt FROM tblRessidence";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
$totalRes = $myRow['cnt'];
}

// get residences pr. continent
$sql = "SELECT coTitle, COUNT(r_ciID) AS coCnt FROM tblContinent, tblCountry, tblRegion, tblCity, tblRessidence WHERE coID = c_coID AND cID = rg_cID AND rgID = ci_rgID AND ciID = r_ciID GROUP BY coTitle";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
switch($myRow['coTitle'])
{
case "Europe": $europePercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Asia": $asiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Africa": $africaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "North America": $northAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "South America": $southAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Australia and Oceania": $australiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
}
}

print "Europe: " . $europePercentage . "<BR>";
print "Asia: " . $asiaPercentage . "<BR>";
print "Africa: " . $africaPercentage . "<BR>";
print "North America: " . $northAmericaPercentage . "<BR>";
print "South America: " . $southAmericaPercentage . "<BR>";
print "Australia and Oceania: " . $australiaPercentage . "<BR>";
?>

Getting vars from MySQL to Flash

Getting Vars From MySQL To Flash
I have a MySQL database from where i need som info. presented in flash.

Here's my PHP code. E.g. i need the info(vars) of $europePercentage to be presented in my movieclip in flash.

Can anyone help me with the AS (flash) code to make this possible?

Hope someone can help

/Kafir

<?php

// start the session
session_start();

include ($_SERVER["DOCUMENT_ROOT"] . "/include.php");
include_once ($GLOBALS['homeDir'] . "common/functions.php");

// check whether the user is logged in or not
//checkUserLogin();

// initalize vars
$europePercentage = $northAmericaPercentage = $southAmericaPercentage = $asiaPercentage = $africaPercentage = $australiaPercentage = 0;

// get each of the countries and set them
$sql = "SELECT cID AS id, cTitle AS title FROM tblCountry UNION SELECT coID AS id, coTitle AS title FROM tblContinent";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
$$myRow['title'] = $myRow['id'];
}

// get the total number of residences
$sql = "SELECT COUNT(rID) AS cnt FROM tblRessidence";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
$totalRes = $myRow['cnt'];
}

// get residences pr. continent
$sql = "SELECT coTitle, COUNT(r_ciID) AS coCnt FROM tblContinent, tblCountry, tblRegion, tblCity, tblRessidence WHERE coID = c_coID AND cID = rg_cID AND rgID = ci_rgID AND ciID = r_ciID GROUP BY coTitle";

$result = mysql_query($sql)
or die("error: " . mysql_error());

while($myRow = mysql_fetch_assoc($result))
{
switch($myRow['coTitle'])
{
case "Europe": $europePercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Asia": $asiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Africa": $africaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "North America": $northAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "South America": $southAmericaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
case "Australia and Oceania": $australiaPercentage = ceil(($myRow['coCnt'] / $totalRes)*100); break;
}
}

print "Europe: " . $europePercentage . "<BR>";
print "Asia: " . $asiaPercentage . "<BR>";
print "Africa: " . $africaPercentage . "<BR>";
print "North America: " . $northAmericaPercentage . "<BR>";
print "South America: " . $southAmericaPercentage . "<BR>";
print "Australia and Oceania: " . $australiaPercentage . "<BR>";
?>

Getting vars from MySQL to Flash

Loading Php Vars (from Mysql) To Flash
Does anyone know if it is possible to load php variables into flash with out echo/print

I have a mysql database that loads the variables from an ID...





























Edited: 11/01/2007 at 11:09:23 AM by MikeM2

Sending Vars From Php/mysql To Flash
Im busy building a php/mysql website using flash as navigation. I'm trying to get some vars from php into flash. This works as long as i say for example: echo "&title=FlashNav"; The dynamic textfield named title in flash shows "FlashNav" so the connection between flash and php works correctly.
But If a want to dsiplay a field out of my mysql table, Flash shows a empty textfield. I'm using te following code:
$perrij=mysql_fetch_array($resultaat);     
$title=$perrij["name"];
echo "&title=$title"

Can anyone tell me why this doesnt work, in the php file it's echo'ing the right content but flash doesnt show anything.
Please help me

Send Vars Securely And Safely To Php MySQl Db
Hi all,

i was making a game in flash that sends the final score to a db threw php mySQL. But since i know that flash actionscript can be red i need a safe way to send data to my php.

anyone know how to achieve this ?

thx a lot
!

Flash Fails To Parse PHP Vars When Retrieved By MySQL Query.
FACTS
1. I'm using PHP to query a mySQL database.
2. I'm using the LoadVars class to retrieve those variables from PHP into Flash.
3. I'm using Flash 8, PHP 5, and MySQL 5.



PROBLEM:
Flash will not parse the PHP page if I include a MySQL
query on that page. The variables are passed, but Flash
doesn't read them.


For example, this code below works fine on its own:


Code:

$tagline = " some word";

echo ("&tagline=$tagline");

But when I add the mySQL query, Flash fails to
pickup the variables even though they show up as URL
encoded in the source of the output html page.


Code:

db_connect();

$sql = 'SELECT
tagline
FROM
some_table
ORDER BY RAND() LIMIT 1';
if( ($result = mysql_query($sql)) === FALSE )
{
echo mysql_error();
} else
while ($row = mysql_fetch_assoc($result))
extract($row);

echo ("&tagline=$tagline");
This is the actionscript I'm using:


Code:

tagData = new LoadVars();

tagData.onLoad = function(write){
text = this.tagline;
}
tagData.load("variables.php");

Can anyone think of a workaround for this?

MySQL Highscore List
Hi, I am trying to make a global highscore list for my website using mySQL. I can get flash to order the highscores, but what I don't know how to do is:
1.Send the data to the mySQL server
2.Get the mySQL Server to save it to a file
3.Get the mySQL Server to retrieve it from a file (when loading highscores)
4.Send to the flash movie

The database's name is: a0026836
It's located on: lukeflash.com (same as flash movie-except different directory)

Please someone help!

MySql With A Drop Down List
If I have variables coming in to flash from a PHP script.

Whats the best way to populate a drop down list with these variables?

Any help much appreciated. Thank you.

List Vars From LoadVars
Is there a way to list the vars retrieved from loadVars?

Thanks,
e39m5

Data List In Flash MX With PHP & MySQL
Helloes all!

Im working on a Flash site and I need to use a MySQL data base for it. I've never worked with that much programming before and Im having trouble now..

What I need is to make a list of movie titles that would be buttons. Now, I understood how to make a list by creating dynamic text fields using AS only i don't know how to make them buttons, since the fields only exist in my AS code. Is there a possibility to do that? Or at least to create each text field inside a movie of its own that would have a transparent button over it? But then I need to create that button in AS as well.. ahh!!

Here's the code I have so far:


ActionScript Code:
limit = 12;
l = new LoadVars();
l.load("http://intranet:7331/get.php");
l.onLoad = function() {

myy = 30

myTextFormat = new TextFormat();
myTextFormat.font = "MyArial";


_root.createEmptyMovieClip("mymovie",500);

for(i=0; i<limit; i++){
            mytextfield     = "mytextfield" + (i)      
            _root.mymovie.createTextField(mytextfield,i,30,myy,300,18);
           

            _root.mymovie[mytextfield].embedFonts = true;
            _root.mymovie[mytextfield].setNewTextFormat(myTextFormat);
            _root.mymovie[mytextfield].setTextFormat(myTextFormat);
            _root.mymovie[mytextfield].border = false;
            _root.mymovie[mytextfield].text += +this["title"+i]+" ("+this["date"+i]+")";

            myy+=18
    }
    myscrollpane.setScrollContent(_root.mymovie);
    }

If anyone could help it would be very much appreciated

Mailing List And Sending Vars
Hi,

Trying to replicate an HTML form in Flash

HTML FORM :


Code:
<form method=post action=http://www.ymlp.com/subscribe.php?myUserName>
<td width="180"><input type="text" name="YMLP0" size="30"></td>
<td width="227"><input type="submit" value="Submit"></td>
</form>
ACTIONSCRIPT :


Code:
var listURL:String = "http://www.ymlp.com/subscribe.php?myUserName";

var request:URLRequest = new URLRequest(listURL);
var vars:URLVariables = new URLVariables();
vars.YMLP0 = inputText.text;
request.data = vars;
request.method = URLRequestMethod.POST;
navigateToURL(request, '_blank');
If I send the form without any vars, I get the correct response from the php - a page telling me I need to fill in an address.

If I add the var as in the code above, I get the same response.

Any ideas? Thanks

Checking A List Of Vars For Similar Values ?
This one's a little hard to explain.
here goes...

I have a list of variables imported from a dbase/textfile. Looks something like this:

&title1=blablabtitle&content1=blabcontent&date1=au gust 2002&title2=balbalb&content2=balbalmorecontent&dat e2=march 2003&title3=...&content3=...&date3=august2002&item count=3

Its a list of, let's say 50 items. These items provide content for dynamically generated movieclips on a timeline-like interface.

Some items share a same date (e.g. august 2002). when there's two things in a same month, I need to generate two movieclips that pop out of my timeline...

I need something that tells me:
august 2002 --> 2 items
september 2002 --> 1 item
november 2002 -->3 items
december 2002 --> 1 item

how should I do this / what technique should I use ?

hope this makes a little sense...
thanks

List The Five Latest Posts From The Mysql Database In Flash MX?
Hi!
I am a newbie to Flash, I wonder how I can list the 5 latest posts from a mysql database in Flash?+

My index.php file looks like this:

<?
mysql_connect("localhost", "user", "pass")
mysql_select_db("dikter.dikter");

$dikter= mysql_query("SELECT * FROM dikter.DIKTER ORDER BY titel ASC LIMIT 5");
?>


So my question is how I should list these data in flash? What codes do I have to write in Flash to make it go?

/Thanx for answering..

Problem With "&" Getting Vars From Mysql
Hi.

Hi have a mysql database with company names.

i'm listing this name on a input box.

the problem is that companies like "Me & Co." just shows "Me".

Can someone help?

Export Querries From Flash 8 To MySQL And Import Data From MySQL
Hi friends,
I am making a web site for a customer and i need to import data from MySQL Database but i don't know how to do it.
I would appreciate it if somebody could give me an idea or tell me where to find a tutorial.
Also i heard that there is a .dll file that Macromedia made, in order to make it easier to connect Flash with Databases, is that true ?

[FL8 + PHP + MySQL] Adding/Deleting/Viewing Content From MySQL Db
So... Viewing isn't actually the issue here, I just added it to make it a full triangle . I'm doing that with a PHP that writes the contents of the dB in XML syntax.

But, to make it clear, I am trying to develop an application that communicates with a MySQL database, via PHP. And you have the option to add/delete fields, but also in the Flash application.

I found some source at the gotoAndLearn forums, but it simply would not work! I am uploading a zip of the files. The main problem with this is that when I am adding something, the dB gets filled with blanks. This boggles my mind. Not being a big PHP knower (not knowing anything, really), my suggestion is that the variables don't get sent properly. But then again...

Some help with this please? I'm in a kind of a tight spot here, so some help would be really in handy!

Cheers

POLL: Best AS3 Send Vars And Load Vars Method
Hi Guys,

Can you help me decide which way to go with as3 to php and back again.

I generally use sqlite, xml or mysql for a database. I don't know if that matters. And sometimes (rarely) I don't use a database at all.

In the past (with as2) I always went custom. Im not sure If id be better off doing something else.

If you have another suggestion please let me know.

Converting ALL Vars Of A Clip To Global Vars -possible?
I wonder if it is possible to convert ALL variables set within a movie clip to global variables, using a self-defined prototype like movieclip.varsToGlobal or something like that. Here's the code I tried:


Code:
for (z in this) {
if (typeof (this[z]) != "movieclip") {
eval("_root."+z) = eval(z);
}
}


This seems to work, it copies ALL items found in the clip (excepted movie clips) to the root. But I am not sure WHAT things are duplicated to the root exactly. Just the variables? Or anything else I don't expect?

Mike
x-pressive.com

Local Vars Versus Class Vars
Hey guys, if a function gets call alot of times, such as a collision detection function in a game, will it be quicker to run if the variables for the function are declared and initialised outside the function as class variables? Or should they are declared and initialise inside the function as local variables everytime it is called, for good software engineering?

For Cycle - AS2
Hi all,
I'm just a newby in As, so accept my apologies for dummy questions

In a new site, I need to create dynamically a raw of buttons (from a min of 2 to a max of 4), in which there will be always at least an image linked to the first button, and a small text linked to the last. In a word, every gallery I need to create will have from one to three images and then a small text.

I'm trying to develop a for cycle, but there is something wrong. In the library I've prepared the 4 buttons, with linkagename "pulsatondo1", "pulsatondo2", "pulsatondo3" and "pulsatondo4".
This is the code I'm trying to use:

var totbuttons:Number=4
var url:String="Mc"+i

for(var i:Number=0; i<totbuttons; i++){
var mc:MovieClip=this.createEmptyMovieClip("Mc"+i, i)
mc.attachMovie("pulsatondo", "pulsatondo_mc" +i, 10)
}

... but nothing happens. I think the problem is the url variable, maybe I mudt not use a string var, or maybe the èroblem is with "Mc" + i...
Could anyone give me a word of hope?

thank you in advance

AS 2 For Cycle
Hi all,
I'm just a newby in As, so accept my apologies for dummy questions

In a new site, I need to create dynamically a raw of buttons (from a min of 2 to a max of 4), in which there will be always at least an image linked to the first button, and a small text linked to the last. In a word, every gallery I need to create will have from one to three images and then a small text.

In the library I've prepared the 4 buttons, with linkagename "pulsatondo1", "pulsatondo2", "pulsatondo3" and "pulsatondo4".
This is the code I'm using:

createBtn()
function createBtn() {
trace ("createbuttons");
var totbuttons:Number=4;
pulsacontainer_mc.createEmptyMovieClip("btnMc", 0);
for(var i:Number=0; i<totbuttons; i++){
var mc:MovieClip=pulsacontainer_mc.btnMc.attachMovie ("pulsatondo"+i, "pulsatondo_mc"+i, i);
mc._x=300 + 45*i;
mc._y=300 + 30*i;
}
}

... and the function goes wrong, I can't recalli it in callback but the trace shows in the output!!!

another question: how can I modify var totbuttons? I have to recall the function in this manner : createBnt(totbuttons = 4) ....?
Or in another wway?

thank you in advance

Cycle An Image Using AS?
Hi all! Is there a code to cycle an image using AS? What i mean by this is say i want the image to scroll across the screen, and then when it hits a certian spot, start all over.. this way i dont have to make a 100000000 pixel wide image Thanks guys..

End Loop At 3rd Cycle...
im animating a MC through actionscripts. im very new to actionscripts so please bear w/me.

here's my code:

onClipEvent (enterFrame) {
this._x+= 5;
if (this._x>=100){
this._x= 0;
}
}


this obviously keeps looping... how do i make it stop looping after reaching the 100pixel for the third time?

thx in advance
H

Cycle Through Colours
hey, i've created code that draws a bar graph based on data returned from a dBase. I'm wanting each bar to be a different colour. The number of bars is always different (from 1 bar, to a 20-bar chart).

How can you do this so it cycles through the colours of the spectrum evenly? (ie: 3 bars = red, green, blue. 7 bars = red, orange, yellow, green, aqua, blue, violet) etc, based on the number of bars?

I know it's going to be along the lines of:

bar8Colour = toHex(spectrum/totalbars * 8);
bar9Colour = toHex(spectrum/totalbars * 9);

Cycle Through All The Sub Movieclips
Is there a good way cycle through all the submovie clips of a parent movie clip...

I know if they were named squentially i could go through them that way...but what if they arent....

any ideas??

Hue Cycle Animation
Hi.

I have an image, and I would like to animate it. What I would like to do, is shift the image through every hue, and have it play as a movie clip in a loop.

The general stuff is not a problem, but does anybody know how I can achieve the hue-shift? Would some actionscript do this for me? If so, could you maybe post the actionscript?

Thanks for your time.

6 Button Cycle
m trying to create a 6 button circular cycle in flash with movie clips. This cycle can rotate with the user clicking on any of the 6 buttons. My buttons are named in the array below. "healthySkin" is the main button position, which means, when the user clicks on any button, the movie clip under that button rotates into this position. My problem here is that, once the user clicks on any button and rotates into this position, how do i know which movie clip is under the original buttons, to tell that movie clip to go to where the healthySkin button originally was.

heres what i got so far... which i am just guessing

function Nav(obj:MovieClip) {
var navigation = new Array["healthySkin", "environMoist", "lowerSkin", "drySkin", "waterInfusion", "healthyCellular"]();
for (var i = 1; i < navigation.length; i++) {
obj[navigation[i]].onRelease = function() {
//want to rotate the cycle here
};
if (navigation[i] == "button1") {
//scale the movie clip which enters into button 1 position
//disable the other movie clip buttons until the user clicks
//a close button to get back to the main cycle
}
}
}

[F8] Walk Cycle
I need a walk cycle which the stick figure increases in pace, so he starts of slowly and then increases with the walk.

Please help

Game Cycle
Hi everyone,

I'm creating a simple flash game and I've read TONS of tutorials for the past couple of days, but none of them seem to answer my question.

I have one character, with 5 frames of animation in the movie clip. I would like to know how when you press either up, down, left, right, or go diagonally in any direction, flash plays the animation and the character movies in that direction. However, I also want to make it so that when you release the key, the animation stops at the specific place it was left off, and when you go in the same or another direction, it picks up where it left off.

Any help is appreciated. Thank you!

[CS3] AS2 Cycle Through Characters
Hi

I'm trying to do an effect where I have 3 characters (w b p) in 3 different textboxes and then each to cycle through random characters before reaching the correct one (say after 10secs), then to play a frame once completed. I can do this through loads of textboxes on the timeline, but would like to do it all in AS2. Does anyone know a good tutorial or which types of functions I would use so I can research it?

Thanks

Cycle Through Buttons
I have buttons that scroll a mc to different x postions. I also have a forward and backward button that cycles through the array i established for the x positions. How do I get the forward/back buttons to visually cycle through the down state of the other buttons?

Here's my code


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

AS 2.0 - End Of Product Cycle?
I recently read an online post which left me with the impression that ActionScript 3.0 is not only more powerful, but easier to use than AS 1 or AS 2.0.

This has me wondering, will AS 2.0 be obsolete within the next year or two [I am still using Studio 8]?

Trying To Cycle Through 5 Images
This is my code, but only store1 and store5 fade in, then the movie stops. Where am I going wrong?



import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.TimerEvent;
import flash.utils.Timer;

var store1_mc:MovieClip;
var store2_mc:MovieClip;
var store3_mc:MovieClip;
var store4_mc:MovieClip;
var store5_mc:MovieClip;
var imageRequest:URLRequest;
var imageLoader:Loader;
var minuteTimer:Timer;


store1_mc = addImage("store1.jpg", 0);
store2_mc = addImage("store2.jpg", 0);
store3_mc = addImage("store3.jpg", 0);
store4_mc = addImage("store4.jpg", 0);
store5_mc = addImage("store5.jpg", 0);


store2_mc.visible=false;
store3_mc.visible=false;
store4_mc.visible=false;
store5_mc.visible=false;

TransitionManager.start(store1_mc, {type:Fade, direction:Transition.IN, duration:2, easing:Strong.easeOut});

minuteTimer = new Timer(4000);
minuteTimer.addEventListener(TimerEvent.TIMER, onTimerFired);
minuteTimer.start();



function addImage(imageURL:String, imagePosition:Number)
{
var image_mc:MovieClip
image_mc = new MovieClip;
imageRequest = new URLRequest(imageURL);
imageLoader = new Loader();
imageLoader.load(imageRequest);
image_mc.addChild(imageLoader);
image_mc.x = imagePosition;
addChildAt(image_mc, 0);
return image_mc;
}



function onTimerFired(event:TimerEvent):void
{
if (store1_mc.visible == true){
store1_mc.visible = false;
TransitionManager.start(store2_mc, {type:Fade,direction:Transition.IN, duration:2, easing:Strong.easeOut});
}

if (store2_mc.visible == true){
store2_mc.visible = false;
TransitionManager.start(store3_mc, {type:Fade,direction:Transition.IN, duration:2, easing:Strong.easeOut});
}

if (store3_mc.visible == true){
store3_mc.visible = false;
TransitionManager.start(store4_mc, {type:Fade,direction:Transition.IN, duration:2, easing:Strong.easeOut});
}


if (store4_mc.visible == true){
store4_mc.visible = false;
TransitionManager.start(store5_mc, {type:Fade,direction:Transition.IN, duration:2, easing:Strong.easeOut});
}


}

Stop At Cycle End
I'm trying to figure out how to stop I mc's animation at the end of the current cycle (or begining of next) but I want it to finish the cycle first.


ActionScript Code:
so gotoAndStop(0);

does not work because the animation stops in the middle of the cycle.

Does anyone know what i need to do to make this happen ?

mm

Cycle Through Button
Hi, how would I create a collection of my buttons so that I can step through it and perform action such as append "_btn" to all button names etc. How would I do that?

Cycle Through Swf´s In Folder
I could really need some assistance.
I am using the "Preloader and Transition for Dynamic Files" tutorial.

What i want is to have a forward and a backward button, so that you can cycle through some swf´s located in a folder.

*s

Walk Cycle
Wow i havent posted here in forever. Anyway, does anyone know how to do a good walk cycle. either stick or symbols. i know the shape tween version. i just need the general walk cycle to study. thanks

AS2 - Cycle Through Characters.
Hi

I'm trying to do an effect where I have 3 characters (w b p) in 3 different textboxes and then each to cycle through random characters before reaching the correct one (say after 10secs), then to play a frame once completed. I can do this through loads of textboxes on the timeline, but would like to do it all in AS2. Does anyone know a good tutorial or which types of functions I would use so I can research it?

Thanks

Break The Cycle
I've got this cycle:

myInterval = setInterval (slideShow, 5000);

function slideShow () {
gotoAndPlay (13);
}

and I want to break it using a stop button. I'd like it to play forever if left untouched, but to stop with a button. a generic stop won't do it.

anybody?
thanks.

How Do I Cycle Through SWFs?
Hey all,

I was well on my way creating a Flash banner with 4 different buttons which users could press to select different SWF files for viewing. Then I found this tutorial on kirupa, and just followed that instead.

My question is, how can I modify this banner setup so that it cycles through the 4 different SWF files without user intervention? On top of that though, I want the users to be able to stop the cycle and, if they'd like, be able to choose a specific ad.

I'm no actionscript guru, but I'm thinking its something along the lines of when an SWF reaches a certain frame, it load the next one. However, when one swf ends and the next one begins, will the first one close so it doesn't take up the processor?

Thanks in advance.

Walk Cycle
Hi everyone
I encountered some problems while creating a walk cycle
I use Flash 2004 MX and I created head, body, left leg, right leg
left arm, and right arm seperately as graphic symbols
then I created a movie clip which contains all of the above symbols
Each symbol has their own layer in the movie clip

My problem is that when I drag the movie clip into a scene and
test it, the parts that move are all gone!! All I see are just the head and the
body!!! WHY ??:roll: I'm so confused!

another thing is that I don't know how to make the walk cycle a real cycle
'cause I can't make it loop :shock:
I tried to use actionscript gotoAndPlay(1); to make them
start from frame 1 but it didn't work.....

Can someone please help me?
Thank you very much :D

Random Image Cycle
hey guys and gals.

getting stuck with a little thing ive been jumping back and forth on the past coupe days, wondered if anyone can help?

ive got 4 movieclips overlapping, inside each, 4 buttons with images inside.

when the swf opens, the movie clips tell 3 buttons to hide, leaving one visible so you get the effect that only four images are showing.

--what i want to happen is as follows--

click on any of the images and it cycles through the other mc's for an image at the same position, hides the original and shows the new one. i want this to be random, so that you click and image and any of the other three show in its position.

so if that happens for all of them you get the four images revealing one larger image.

get it? anyway, ive got 2 bits of code that should work but dont give off the correct effect, rather than post that can someone give me their thoughts on what should work and ill post my code after that to compare?


thanks... sorry for the long post.





cuse

Animated Walk Cycle
Hello, I have been looking for a tutorial on making a simple animated walk cycle in either flash5, or MX....does anyone know where I might find such a thing?

Creating Gun Firing Cycle?
I'm having trouble creating a simple shooting gallery style game. I have two movie clips; a crosshair target (which replaces the mouse pointer) and a perspective view of the gun. The gun movie clip animates when a shot is fired, however the first frame has a 'stop' line while the gun is idle. To fire the gun with the left mouse button I added this code to the crosshair movie clip:

onClipEvent (enterFrame) {
if (Key.isDown(1)) {
_root.Pistol.gotoAndPlay(2);
}
}

This works fine if you tap the mouse, but obviously holding the button down will keep the gun movie clip on frame 2. So I started playing with a 'fire_status' variable that would only animate the gun once an entire cycle had been completed. This is where I get stuck. How do I declare this variable? I know it must be global but nothing seems to work! Any ideas?

Complete Movie Cycle
I am currently working on a gallery for images. I've built preview buttons with a fade movie on the over state. I was wondering how I could tell the movie to complete it's cycle from the over state once the mouse has moved off the botton.

My idea was inspired by the images buttons at:
www.fullsail.com
The page that I'm working on is at:
http://www.image202.com/2.0/I202_Portfolio_PR.html

It's still under development.

Let me know any suggestion/insite.

thanks much.

Interrupting OnEnterframe Cycle ?
hello people here is my dilemma

i'm loading mcs onto another mc on the main stage
this mc is called "container"
now instead of putting a preloader on each loaded mc i put just have one loader check which i put on the container mc on the main stage

this is the code


Code:
onClipEvent(enterFrame){
_root.pcloader = this.getBytesLoaded()/this.getBytesTotal()*100;
if(_root.pcloader >=100){ _root.pcloader=" loaded";
}

}




this works fine still i would like to optimize the code
that's because the enterframe loop its still active even if the movie is loaded , can you help me ?
i got mx/2004 pro

hope i explained well
thanks

Simple Colour Cycle
hi flashers... i have a movieclip, 700x400 with a simple gradient running from the top left to bottom right, red to orange, very pretty... what i'm after is for the movie clip to gradually cycle through the rgb colours over a certain time... i don't really want to do this with tweens as i figure it'll add too much to the file size... any ideas would be greatly appreciated...

many thanks

tasvin

How To Create Arrays In Cycle
Hi guys!
I have this function in Menu class:
code:
private function getSecondLevelNames():Void{
var xmlNode = __xml_menu.firstChild; //first child of XML object
var tempArrayX = new Array();
var finalArray = new Array(); //this is not used yet
for (var i = 0; i<xmlNode.childNodes.length; i++) {
//what to write here??? eval("tempArray"+i).push(xmlNode.childNodes[i].attributes.title);
for (var j = 0; j<xmlNode.childNodes[i].childNodes.length; j++){
tempArrayX.push(xmlNode.childNodes[i].childNodes[j].attributes.title);
}
}
}

The problem is:
I would like to create an array for each xmlNode.chilNode but I have no idea how to do it as the arrays have to be declared. Of course I could put var tempArray0 = new Array; above the cycle, but what if the XML changes and it will have more child nodes? I hope somebody understands what I want to get.
Any help greatly appreciated!
Thanks

Poco

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