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




Random Sender Not Working



In the attached file, I have three parts of a game that I was working on, I took a break from this game for a while, and forgot a lot of what I did...anyway in the attached file the white box, is supposed to send random movieclips, the red guys and the brown guys, 1-10 out across the stage...but it's only working for movieclips 1-5, not 6-10...I cant figure out why, I have tested and chaged things around, but I cant seem to get it...can anyone figure out whats wrong with this that it wont send out 6-10...any help is greatly appreciated



FlashKit > Flash Help > Flash ActionScript
Posted on: 06-24-2004, 03:17 AM


View Complete Forum Thread with Replies

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

Random Sender Not Working
In this filehere I have 10 enemy movieclips that I want to be sent across the stage randomly by and 11th white movie clip to the side. This was working for only MC1-MC5, none of the others, so I took one of the other, red guys, and deleted it and replaced it with a copied and pasted brown guy, thinking that I had an error in the red guy's MC, this wasnt the case...I have tried many other things, but I cant get any of those MC's to be sent out...any help to solve this is appreciated

Return To Sender Help
I have two search fields triggered by either a mouse release or the return button, but hitting return only triggers one search field! Is it possible to get around this?

Email Sender
Im trying to create a script that will check what state the user lives in, and then will send an e-mail using the formmailer.pl that I got for my server. I have a listbox, and its component name is STATE, so if anyone could help me out....

I tried using if end if statements to do this, but it didnt work. So, if anyone could help me out, that would be greatly appreciated. thx!!!

Mail Sender (no Php, Xml, Etc)
im having a little problem here coz i want to make a mail sender form within flashmx (not 2004) but i dont want to use any php, xml, or any other lenguage.....i need to know if there is a way to make this just within actionscript and html....or maybe if theres a app like mailform for flash.....

anyone that can help here?

Change Sender?
i have a simple mail php script (probably going to convert it to perl though). so users fill out a contact form, and it mails the info out. the only downside is that the return sender for the email is the service provider. there is a box for an e-mail address in my form, so my question is... if they fill out an email address in that box, could i have the script somehow make the e-mail "from" that address? so i can click reply and have it go to that address?

Check Sender
Hi,

I have a lot of input boxes, that updates a given URLVariable.
I want to update the variable each time the text in the input box changes.
So far i have added an event listener, that listens for keyboard clicks, but i need to check for which box is active so that i can update the correct variable. How do i do that?

Making A Email Sender...
ok this is want i want to do, im not sure if it will work but.....

a box that you type in your email, then automatically it will send and email to the adress that i have already typed up, is that possible, and if so how wuold i do it?




Thanx a bunch

Lewis

How The Simple SMS Sender Works...
Few of you asked me how my SMS sender works, so I will try to explain it.

First of all, it has not much with SMS.
But...
It is a Form-Mail. This mail I'm sending from the server (PHP).

Now the trick:
The recipients e-mail is forwarded to mobile device, as an e-mail alert.
This feature must be provided by your GSM provider.
Here in Croatia we have just two providers (VipNet & CroNet) and at both of them this feature is free, but is must be turned on manually.
First check out your GSM provider!!!

As the e-mail is just 145 character long (and plain text), the message is completly visible at recipients mobile device.
BTW: I've set up my e-mail client to read these e-mails, so they are comming into my Inbox too.

If someone find a bug or has a question, please contact me.

For source click here (and don't forget to read the comments in the source).

Good luck!
Akos Papp

Mail Form Sender
i have my "form.php" file of the "contact" section of my site uploaded to lycos.co.uk (cos thats the only site which supports PHP, as far as i know).


when i try to send email thru it, i do receive the email to the address i provided in the PHP file -BUT- in the "from" field it is from "myusername@lycos.co.uk "

y is that? ( i have attached the php) can someone help me?

Flash Email Sender Query ?
hi all... in the past i have been working on this site www.ausstellung.net with a friend of mine. My dutie was designing, and

generally coming up with ideas...he also designed parts of it too, but he had more control over this, as he was more web literate than me, and so was able to add things that i had no comprehension of how they worked. I have now pretty much caught up with him in flash, however,there are still a few things i have to learn, so he gave me the .fla file to work from (as i usually find it easier and more effective to learn from deconstrustion of examples given to me) only thing is, he's very competative, and so he won't teach me how things/techniques are done (i find this rather frustrating) - btw, please visit the site to see what i'm refering too. i'm kinda hoping someone can shed some light explaining the workings of the email subscription submission (top right of the navigation). I've looked at the symbols and movie clips that make up this email behavior, but can't quite work out how the actionscripting is working it all out,and how it knows how to send the user input (name/email). the following code is attatched to the 'submit' button :

on (release) {
tellTarget ("/emailsent") {
play();
}
// http://cgi.uk2.net/cgi-bin/uk2-formmail.pl
getURL("http://cgi.uk2.net/cgi-bin/uk2-formmail.pl", "_blank", "GET");
// info@ausstellung.net
}

[this is all contained within a symbol called 'EMAIL']

also within the same symbol is three pieces of text...

http://www.ausstellung.net/thankyou.html **
Ausstellung.net mail list reply
info@ausstellung.net

now i know that when you send your email address and name using this, it opens up a browser window and loads

...http:ausstellung.net/thankyou.html **...(by the way, the astrix's are just for reference) but atm this page seems to have broken links too all the pictures, but i assure you it's purely a graphic way of notifying 'thank you' to the user. So does the 'ausstellung.net mail list reply, and
info@ausstellung.net provide the information on where to send this user input. (i've personally experienced recieving the emails from the user input on our site)

I'm currently working on a site atm, and i'm really wanting to be able to layout some input text boxes and a send button, so that the user's can send certian email to my email address...so it's exactly the same as whats going on in the ausstellung site, but with more info, such as their address, and telephone number etc etc...

sorry if this all sounds a bit odd, and confusing..but that seems to be the world of web desinging from a designers point of view i'm afraid..hehe

any help would be gratefully aprerciated

thanks

miss parodius xxx

Frustrated With Flash/Php Mail Sender
Hello. i have almost a week trying to find why this scrip does not work like it has to. i have done it before the same way and it works, but not this time.

please, i need help...

flash script

Code:
onClipEvent(load){
mydatain = new LoadVars();
mydataout = new LoadVars();

function parapapa(){
_root.output.text = mydatain.cucu;
if(mydatain.cucu == undefined){
_root.output.text = "Couldn't stablish a connection";
}
}

if(_root.select == 1){
direccion = "name 1";
}
if(_root.select == 2){
direccion = "name 2";
}
if(_root.select == 3){
direccion = "name 3";
}
if(_root.select == 4){
direccion = "name 4";
}
if(_root.select == 5){
direccion = "name 5";
}
if(_root.select == 6){
direccion = "name 6";
}
_root.titulo.text = "Please type your email to " + direccion;

function validate(address) {
if (address.length>=7) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
}
}

on(press){
mydataout.mail = _root.email.text;
mydataout.mensa = _root.come.text;
if(_root.select == 1){
mydataout.destino = "mymail@mail.com";
}
if(_root.select == 2){
mydataout.destino = "mymail@mail.com";
}
if(_root.select == 3){
mydataout.destino = "mymail@mail.com";
}
if(_root.select == 4){
mydataout.destino = "mymail@mail.com";
}
if(_root.select == 5){
mydataout.destino = "mymail@mail.com";
}
if(_root.select == 6){
mydataout.destino = "mymail@mail.com";
}


if(validate(mydataout.mail)){
if(mydataout.mensa !== "" && mydataout.mail !== ""){
mydataout.sendAndLoad("mailto.php", mydatain, "POST");
mydatain.onLoad = parapapa(success);
}else{
_root.output.text = "Please, fill the empty text box.";
}
}else{
_root.output.text = "Email address not valid.";
}

}



now, on the php side:


PHP Code:




<?php
$email = $_POST["mail"];
$mensaje = $_POST["mensa"];
$desti = $_POST["destino"];

mail($desti, "Information request from Prpharma.com", "The user ". $email ."has sended you a message requesting information about Puerto Rico Pharmaceutical:

".$mensaje, "From: Prpharma.com");
echo "&cucu=Message sended!!!&";
?>







pleeeeeeeeease!!! why isn't working?????!!!!!!

[CS3] Receiver And Sender As One W/ Multiple Instances?
Here is what I am trying to do:

I am making small circles that when clicked expand an attached information box. Clicking this circle again closes the attached information box.

The Problem:

I will have at least 3 of these Circle.swf instances that are generated from the same FLA, just the swfs have different titles (1,2,3, etc). When activating one, the others will recognize this and will close.

I am wondering if there is an efficient way for Circle.swf to have both Listening and Receiving occurring simultaneously and across nearly identical instances in my HTML?

I was able to get it working in a very crude way but I am new to using LocalConnection. Sometimes the other swfs would react, sometimes not. It seems as if whichever SWF loads first takes predominance and ones that load later will often not communicate with the initially loaded SWFs.

Thanks for any tips

PHP Form Mail Sender Problem
Hi,
I followed the mailer tutorial offered here and it works fine but I prefer to customize som functions.
I want the email address of the sender to appear in the From field of the outlook for instance.
Now it only appears if i fill the mail address and in i go to the reply to function.
I thhink i have to change somethin in the PHP file.
now it looks like this:
<?php
mail("my@mail.com", $subject, $message, "From: PHPMailer
Reply-To: $from
X-Mailer: PHP/" . phpversion());
?>

Houston We Have A Problem Creating An Email Sender
Hi!

I have to create an email sender with Flash and I've got no clue about it. How can I do it? I tried with a php that I found in this forum but I'm not able to make it run!!!


Any idea?

PHP Email: Tips On Collecting More Info From Sender
I have a php email on my flash site, and was wondering if anyone could give me some code help with how to gather other kinds of information from my visitors location when they send me an email.

eg. Their, Screen resolution, Time spent, Pages viewed, Country, State, City, or anything else that may be useful.

All I have so far is:

$date = date("m/d/Y H:i:s");
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

PHP Email Sender & Flash Integration: Problems
I realise that this has been asked/explained to the death, but I have run into a very specific problem that I could not solve despite my efforts.

I was trying to come find a simple tutorial to include a PHP Email sender in my flash site, and I came upon this site whose link was provided in the Ultrashock Forum:

php form

The tutorial given in this page works greatly given that you follow its instructions AND you keep all of the code in your Root.

The problem is this. Say you have your main.swf. Then you have 2.swf that runs in your main.swf when a button is pressed. If you place the actionscript described in the above tutorial into 2.swf, then load 2.swf from your main.swf using the loadMovieNum command, when you press the "Send" button, you get an email with a Subject and Body "Undefined" This is probably due to wrong targeting... But how do I fix it?

Let's complicate things a bit. Suppose I have main.swf, then 2.swf, then another movie, 2B.swf. What happens if my input text fields are located in 2B(so three levels deep in total). What changes would I have to make to the code if I ran 2B from main using

Main loads 2.swf using loadMovieNum
2 loads 2B using loadMovie("2B.swf", "placeholder")
How would I target this "placeholder"? (Which is a movieclip in the timeline and library of 2.swf) In other words, how should I integrate the code found in the tutorial with this architecture?

I am stuck... I tried contacting the tutorial author, but I have not recieved a response yet so I finally posted it here...

Thank you for all the help in advance.
Cem

Button Code Stop And Play/sender.value Question
ok i have forgotten the code u put for a button that will go to the next frame and stop the movie, as i have 5 frames with forms and they just "loop from 1 - 5" without stopping.

ALSO: after the 5th frame i want all of the user input to be processed via a php file, the question is i have something like this on each frame:

sender.email = email.text

then on the last one:
sender.name = sender.text
sender.send(phpfile.php,0,GET)

the point being will the sender object remember the values of the previous frames or not?

ALSO if i change the GET to POST it still actions it as get ie i still get php?email=paulh

cheers

Random Script Not Working
I have this script in an action frame
but the screen stays blank.
Any ideas?


randomnum = Math.Round(Math.random () * 5);
loadmovie ("response" + randomnum + ".swf", 1);

Random X Function Not Working
The function is supposed to assign a random x value to a movie clip, however it is not working.

Whats wrong with this function?


This actionscript is being called from frame 1 of layer 1 on the root:
function randomX() {
x = _x.random(490)+30;

return x;
}


This script is being called from a movie clip on frame 1 of layer 1 on the root:
onClipEvent (load) {
function randomX();
}

onClipEvent (enterFrame) {
if (_root._currentframe == 1) {
_x = (randomX.x());
}
}

Random Tutorial Not Working In MX?
I found this tutorial here:
http://www.kirupa.com/developer/actionscript/random.asp
and downloaded the file. I tried the final file in MX, and not a movement to see.
Tried to publish for 5 and MX, and absolutely nothing happens, neither in my own file, or the one they've provided.
Anybody got a clue?

Random Movie Not Working
My first post here I have been around here, especially looking at the tutorials for things I'm not good at. Just recently I discovered the forum...
My problem is the following:

I have three swf's:
inside1.swf
inside2.swf
inside3.swf

There's a movie inside.swf that's calling out one file randomly 1, 2 or 3 on every reload of the HTML page. My problem is the following:
inside.swf works great on both local computer and when called in browser (i.e. http://www.mysite.com/flash/inside.swf).

But when the HTML page index.htm that has inside.swf in it loads, I see just the background color of the flash file. It doesn't look like it's calling out inside1, 2 or 3.
Need help on what might be happening.

MANY THANKS
and keep this great forum up.
Mediterrano

[Help]: Random Numbers Not Working...
Hi

I was just writting a small script so that every 2 seconds it would trace a random number between 0 and 4 in the output window, but it is not working!

Here is the code(it is written in the first frame of the file):

Code:
randNum = random(5);
function wait() {
trace(randNum);
}
setInterval(wait, 2000);


The problem is that it always outputs the same number!

However if i replace the randNum in the trace() action with random(5) it works!!!

What could be wrong with the script?

Thanks in advance

Random Variables Not Working..
Okay what i'm trying to do is create a fly that hovers a bit, flies to another location, hovers a bit, flies to another location etc..

But theres some weird stuff happening i dont really understand..

heres the code i've written for now (located in the first frame of the root layer)


Code:
//all variables here
var angle=0;
var speed=0;
var movevar=0;
var setHalt=0;
var waitTime=50;
//animation:

function slide(angle,speed)
{
//make angle a radial number
angle = (Math.PI/180)*angle;
//use angle to set x speed:
var xSpeed = Math.cos(angle)*speed;
//use angle to set y speed:
var ySpeed = Math.sin(angle)*speed;

this.fly._x = this.fly._x + xSpeed;
this.fly._y = this.fly._y - ySpeed;
}
// this function adds to the angle
function rotate(angleVar)
{
angle = angle+angleVar;
}
function accelerate(accVar)
{
speed = speed+(accVar);
}

//important functions:
function wait()
{
waitTime=waitTime-1
if (waitTime==0)
{
setHalt=0;
//set to random
angle=Math.random()*360;
if(this.fly._y>550)
{
angle=225 + Math.random()*90;
}
if(this.fly._y<50)
{
angle=45 + Math.random()*90;
}
waitTime=30+Math.random()*30;
//end random
}
}
function moveStop()
{
if (movevar<11)
{
accelerate(0.5);
movevar = movevar +1;
}
if (movevar>10 && movevar <30)
{
movevar = movevar +1;
}
if (movevar==30)
{
speed=0;
movevar = 0;
setHalt=1;
}
}
//////////////////////////////////
// enterframe events: //
//////////////////////////////////
this.onEnterFrame = function()
{
if (setHalt==0)
{
moveStop();
}
if (setHalt==1)
{
wait();
}
slide(angle,speed);
}


but i'm having problems in the function wait()

this is working:

Code:
angle=Math.random()*360;


but these things dont:
this is supposed to make the fly turn back when it moves to far up or down the screen, and set the time it's hovering to a random number.

Code:
if(this.fly._y>550)
{
angle=225 + Math.random()*90;
}
if(this.fly._y<50)
{
angle=45 + Math.random()*90;
}
waitTime=30+Math.random()*30;


however, if i just set waitTime to 50 or so (not a random number), it works :S
i traced waitTime=30+Math.random()*30; and that just gives me a number, but i really have no idea why it makes the fly stop.

Anyone care for helping me out with this one?

If Random=some Number Not Working.
Ok will I have a text box (Dynamic) called var move and I have this in the mc called cow:

Code:
onClipEvent (enterFrame) {


if (move = 0) {
cow._x = cow._x - 3
}
if(move=1) {
cow._x = cow._x + 3
}
if(move=2) {
cow._y = cow._y - 3
}
if(move=3) {
cow._y = cow._y + 3
}


}
Now the cow doesnt move or anything so I need help please. The cow was going to move which ever number it picked for random movement.

thanks

Random Images - Not Working
I am building a website for a band and i would like to random select an image from one of there gigs. I have uploaded three images (pic1.jpeg, pic2.jpeg,pic3.jpeg.) to my website server and created a folder called images. I have used the following action script which works on my pc off line but it will not work on line.

pic = random(3)+1;
loadMovie("images/pic"+pic+".jpg", "_root.square");

Could anyone advise the quickest and easiest way to do this.

He is the link to the images .

http://www.theglory.co.uk/images/pic1.jpeg

'Random Image' Not Working
Help.

I've created a flash file as part of a HTML site, but sometimes, it just stops working.

Basically, the file loads a random JPEG out of 5. If you keep refreshing sometimes, it stops working...
http://www.thinair-resource.co.uk/or...vestments.html

code in first frame:
frame = Math.floor(Math.random()*6)+1;
gotoAndStop(frame);

then next 5 frames each load an image

The FLA is here:
http://www.thinair-resource.co.uk/ra...nvestments.fla

Any ideas?

Cheers,

Random(2) Not Working In Class
This works in a .fla but when I use a similar setup in a class the random number comes up as undefined?

var randomNumber:Number;

function randomizeSequence(){
trace(sequence);
randomNumber=random(2);
trace(randomNumber);
return randomNumber;
};
var sequence:Array = ["a", "b", "c", "d", "e", "f"];
sequence.sort(randomizeSequence);

Random Function Not Working
Hello,
I've been trying to create a flash website for two days now. So far most of it is up. However Im having trouble with loading random movies or jpegs for display on my site. The code is correct - I've tested it. Im using swfobject and I would like to know if anyone else has had problems like this.

Here is my code...
_root.loadMovie("portfolio" + random(25)+ ".jpg");
container._xscale = 100;
container._yscale = 100;

Its just the random function that seems to be causing the problem as I've created a gallery that loads up specific images using the loadmovie command.
So is there a way to load up random images without the random function, perhaps using an array - if so how? Ot if anyone else could think of a way please let me know!

Thanks for Helping.

Random Motion Not Working
I did the random motion tutorial (mx version) on kirupa, and it isn't working the way I expected. I made a new movie clip that consists of a simple white dot, and put did everything else. When I start the movie the white dots jump around rather than moving smoothly. What did I do wrong

[help] Random Script Not Working
this is the full code that im working on currently.
as you can see after it states the new x,y coordinates, that i have a "battle(m+1);" statement, would i be correct in saying that this ads +1 to the value of 'm' every time the script is exicuted?

therefore with the code down the bottom.
t = m + 9
would become:
t = 1 + 9
which = 10
and put that into the 'p' value
p = ((t/10)-1)*5
((10/10)-1)*5
=0
or say that he took 11 steps
p = ((20/10)-1)*5
=5


Code:
hero = _root.character; //name of mc for the hero
s = 4;
b = _root.character.getBounds(_root.character);
function move(x, y) {
if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymin+1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymin+1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmin+1, hero._y+y+b.ymax-1, true)) {
if (!_root.walls.hitTest(hero._x+x+b.xmax-1, hero._y+y+b.ymax-1, true)) {
hero._x += x;
hero._y += y;
battle(m + 1);
}
}
}
}
}
if (Key.isDown(Key.UP)) {
move(0, -s);
with(character){
gotoAndStop("char_bk");
}
}
if (Key.isDown(Key.DOWN)) {
move(0, s);
with(character){
gotoAndStop("char_fwd");
}
}
if (Key.isDown(Key.LEFT)) {
move(-s, 0);
with(character){
gotoAndStop("char_lft");
}
}
if (Key.isDown(Key.RIGHT)) {
move(s, 0);
with(character){
gotoAndStop("char_rt");
}
}
if (!Key.isDown(key.UP) & !Key.isDown(key.DOWN) & !Key.isDown(key.LEFT) & !Key.isDown(key.RIGHT)) {
with(character){
gotoAndStop("char_stl");
}
}

//make the battle happen!! m/
var t, m, p, r
function battle(m){
t = m + 9 // t = steps take + 9 ( to give =>10 to allow for small numbers )
m = 0 //steps taken
p = ((t/10)-1)*5//percentage of battle
r = random(100)+1;//random integer between 1-200


if (p > r) then
battle = false;
if (p <= r) then
battle = true;

if (battle = true) then
gotoAndPlay("battle");
if (battle = false) then

}
cheers
AnniHilatE

Random Motion Not Working
I did the random motion tutorial (mx version) on kirupa, and it isn't working the way I expected. I made a new movie clip that consists of a simple white dot, and put did everything else. When I start the movie the white dots jump around rather than moving smoothly. What did I do wrong

Working With Random Movieclips. Need Some Help
I'm developing a little temp portfolio, and I could use some direction. I want to have the cars in the link below randomly come on the screen.

http://urbaninfluence.com/daddy/

if you look at what i have now, there is nothing random about it. Would anyone be able to give me a push in the right direction in figuring this out?


Any help is most appreciated.

-mike

Random Movment Not Working
i have a MC called muck on the stage within that there is a small animaton that plays to frame 14 this holds another mcs called muckparts within that mc I have a set of functions

it play if i put the muckparts movie into the root but not within muck mc

Thanks guys



Code:


function getdistance (x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (hyp(run, rise));
}
function hyp (a, b) {
return (Math.sqrt(a*a+b*b));
}
MovieClip.prototype.reset = function () {
var dist, norm, movie_height, movie_width;

movie_height = 204;
movie_width = 127;

speed = Math.random()*4+2;
targx = Math.random()*(movie_width-_width);
targy = Math.random()*(movie_height-_height);
dist = _root.getdistance(_x, _y, targx, targy);

norm = speed/dist;
diffx = (targx-_x)*norm;
diffy = (targy-_y)*norm;
};


MovieClip.prototype.move = function () {
var cycle;

cycle = 200;

if (_root.getdistance(_x, _y, targx, targy)>speed) {x += diffx;y += diffy;
} else {x = targx;
y = targy;
if (!this.t) {
t = getTimer();
}
if (getTimer()-t>cycle) {reset();
t = 0;
}
}
_x = x;
_y = y;
}



and each MC has


Code:


onClipEvent (enterFrame) {
move();
}

How Do I Get This Random Time Delay Working
first frame sets a variable with a random # between1 and 5
_rnd=Math.random(5);

frame 10 asks if variable _rnd is equal to 1 and if it is then to go on and if not to go back to frame one, regenerate value for variable _rnd and so on
if (_rnd=1 {
gotoandplay (11) ;
} else {
gotoandplay (1);
}

this **** dont work
any help please?

My Brain No Working... (random #'s And Arrays)
heres what im trying to accomplish:

elsewhere in my script ive populated an array w/ 30 questions that i pulled from xml.
now, for this project, i need to randomly select 9 of these questions
and publish them to the stage.
my thought was to create a loop that generates a random # and stores it to an array, then continues w/ the loop....
i accomplished this w/ the following snippet of code:



PHP Code:




aSelectedSets = new Array ();
function generateRandomQuestions (){
    //number of total questions to pick from
    var possibleQuestions = 30;
    //number of questions to select out of the total
    var howManyQuestions = 9;
    //start loop for generating multiple random #'s
    while (aSelectedSets.length < howManyQuestions){
        //generate random integer
        var tempNum = Math.floor(Math.random()* possibleQuestions +1);
        //put random # into array
        aSelectedSets.push(tempNum);
        trace (tempNum);
        
    }
}







the problem is, im a bit stuck on trying to figure out how to check to see if the same # is generated 2x.

im guessing i'll have to nest another loop in there somewhere but im not really sure where to go from here...

please point me in the right direction........


thanks in advance

jc

Random Movement Placed Into Mc Stops Working?
Hello all!

I have been try to create my online portfolio and i need a little help with this script! I cant rember exactly where i got the script for this random movement but, the problem is that it works perfectly in the main time line e.g (www.kittenpoo.com/dev/test4.htm)(where the tree is) but if i try to put it into a mc that scrolls (like barneys.com)it stops working. I'm sure its to do with finding the root_ but it has me totally stumped!


Could anyone point me in the right direction please. Thanks allot
The script is below.


onClipEvent (load) {
// minimum and maximum values on x and y axis for your mc
// speed of movement
minX = 1948;
maxX = 2291;
minY = 30;
maxY = 260;
speed = 10;
// destination of the mc
xDest = random(maxX-minX)+minX;
yDest = random(maxY-minY)+minY;
}
// random movement
onClipEvent (enterFrame) {
if (Math.round(_x) != xDest) {
_x += xDif;
xDif = (xDest-_x)/speed;
} else {
xDest = random(maxX-minX)+minX;
}
if (Math.round(_y) != yDest) {
_y += yDif;
yDif = (yDest-_y)/speed;
} else {
yDest = random(maxY-minY)+minY;
}
}

Site I'm Working On, Random Movement Help
here is a site i'm doing:
http://www.ihearditmedia.com/iheard.htm

now I have an mc (headphones) that uses random movement - script I found online. But after a while the headphones move down so the top cable doesn't look like it's coming from the top. Anyone know of a script that would move an mc around a bit - more smoothly and not move it too much off the mark ?

Random Not Working(code Included)
Code:
onClipEvent (enterFrame) {
m = random(4)
if(m=1){
this_x+=6}
if(m=2){
this_y+=6}
if(m=3){
this_x-=6}
if(m=4){
this_y-= 6}
trace(m)
}



thats my code. the trace is only to make sure i get a variety. I only get four, though. I don't know whats wrong.

Random Frame AS Not Working For Some Reason
I wrote the following code and got an error. It is code i got from a forum with about 15 people who said 'thanks, this words perfectly', but it doesn't for me. I have scoured the code but can't find any reason why it will call this error. Any ideas?

function getRandomLabel():String {
var labels:Array = new Array(”quote_01″, “quote_02″, “quote_03″,”quote_04″, “quote_05″, “quote_06″, “quote_07″);
var index:Number = Math.floor(Math.random() * labels.length);
return labels[index];
};

but then I get this error in the output box:
**Error** Scene=Scene 2, layer=actions, frame=1:Line 12: ‘{’ expected
function getRandomLabel():String {

**Error** Scene=Scene 2, layer=actions, frame=1:Line 16: Unexpected ‘}’ encountered
};

what have i done wrong?
Thanks.
Van

Random Motion A/S Not Working On All Instances
Hello,

I'm using this code found on this site for random motion. I have about 40 spheres that I've attached it to. The problem I'm having is I can never get all the spheres to move...usually one to three of them just sit still. And since it's random it changes everytime I view that page. I need them all to move, does anyone have any suggestions?

Thank you.


Code:

onClipEvent (load) {
//data you may want to change
posx =478.9
posy =235.4
width = 5;
height = 5;
//speed = Math.round(Math.random()*2)+1;
speed = Math.random()*.35;
//initial positions
x = this._x=posx+Math.random()*width;
y = this._y=posy+Math.random()*height;
x_new = posx+Math.random()*width;
y_new =posy+ Math.random()*height;
}
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {
sign_x = 1;
} else {
sign_x = -1;
}
dx = Math.abs(x_new-this._x);
if ((dx>speed) || (dx<-speed)) {
this._x += sign_x*speed;
} else {
x_new = posx+Math.random()*width;
}
//y movement
if (y_new>this._y) {
sign_y = 1;
} else {
sign_y = -1;
}
dy = Math.abs(y_new-this._y);
if ((dy>speed) || (dy<-speed)) {
this._y += sign_y*speed;
} else {
y_new =posy+Math.random()*height;
}
}

My Random Frame Settings Arent Working...
i have a code

tellTarget ("_root.info") {
gotoAndPlay(random(5)+2);
}

wich i thought would play either frame 3, 4, or 5 randomly.

however, it still goes to frame 1 and 2 sometimes...
am i doing something wrong?

Random Frame Stops Working When Images Are Used
Hello,
I have built a movie (Flash MX 2004 Porfessional) with the objective of going to a different frame each time the page loads. The movie works fine when I only have text in any of the frames. As soon as I add an image to any of the frames the ramdomization quits working. On top of that, the behavior is Opera/Netscape and IE is different.

In IE, the movie always displaysframe 1 (no content, just the actionscript).

In Opera/Netscape the movie always displays frame 2 (the first frame with content).

The code:

code:
var randomFrame; // Stores the randomly picked frame number
var numFrames; // Stores the total number of frames on the timeline
numFrames = _totalframes; // Assign _totalframes property to numFrames

// Pick a random frame
randomFrame = Math.floor(Math.random( ) * numFrames + 2);

gotoAndStop(randomFrame); // Send playhead to chosen random frame


I have attahed the file for convenience sake.
You can also see the behavior by going to the following two links:

with images (not working)
http://www.prophegy.com/temp/flash.html

w/o images (working):
http://www.prophegy.com/temp/flash2.html

Any insight into why this happens is greatly appreciated!!

John

Flash Container.swf Not Yet Working - 7 Random Banners
So I'm trying to implement some good advice Ryan T gave me - but I can't seem to get it to work - firstly, I just made a new Flash file, made the background dimensions the same as all 7 banners, placed this action script on frame one -

================

var bannerArray:Array = ["HigherThroughputRO.swf", "IWICSlogo.jpg", "GL_Hanbin.jpg", "NoTowers.jpg", "Semaphore.swf", "MoreSky.swf", "TinCan.swf", "TinCanB.swf"];
var banner:String = bannerArray[random(7)];
trace(banner);
this.loadMovie(banner);

=====================

then I get these messages in Flash error console:

====================

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
var bannerArray:Array = ["HigherThroughputRO.swf", "IWICSlogo.jpg", "GL_Hanbin.jpg", "NoTowers.jpg", "Semaphore.swf", "MoreSky.swf", "TinCan.swf", "TinCanB.swf"];

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Statement must appear within on/onClipEvent handler
var banner:String = bannerArray[random(7)];

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on/onClipEvent handler
trace(banner);

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 4: Statement must appear within on/onClipEvent handler
this.loadMovie(banner);

Total ActionScript Errors: 4 Reported Errors: 4

========================

In addition to the code errors, another question I have is do I also have to make a same dimension movie clip and put the code on the first frame of THAT or is it alright to just have the code on the first frame of my banner dimension background? In other words, do we always have to make a movie clip or can we just leave it as a blank container with just the background and proper stage dimension for the random banners?

Thanks greatly

KB

Random Motion - Suprabenner - Downloaded .FLA Sample Not Working
The How to make random motion by actionscript by suprabeener, is cool, but, the sample .Fla doesnt work.

Why ?

[CS3] Working With Lots Of Random Numbers (external Txt File, X And Y Positions, Etc)
Okay so I have a flash cs3 project I am working on. I am very new to the whole thing, especially to working with Actionscript. Essentially what I want to achieve is this: I have a text file full of quotes- I want to randomly load a quote from the file, say, every 100 frames, have it appear at a random position, fading in over the course of 25 frames, remaning for fifty frames, and fading out over the course of 25 frames. I have found a few things that load from a text file into a text field whenever a button is pressed, but my knowledge is too limited to manipulate that code into what I want. Any help?

I am much better with PHP, I am curious as to if it is possible (and not extremely difficult) to execute a PHP program which loads a random quote and stores it into a variable, and then call that variable into the flash file.

Random Color Code Isn't Working When I Export It For Flash Player 7
Well this is my first post here so I think I should introduce myself first.

I'm studying film and animation right now. I've been doing some coding in Flash long time ago so yeah... i'm not a professional in any way. I'm really not good with these introductions ... so i think i'll just get to the point.

My problem is:

I have this code for random color tweening that's working without any problems when i export it as flash 6 but if i try to export it as flash 7 nothing is happening.
if anyone can take a look at this i would be really grateful.

here is the file:
http://www.aircrypt.com/random color.rar

thank you

Random Movie Loader Works Fine In Flash Player But Not Working In Browser
The following code is used to load a random movie onto a movie container. It works perfectly in the normal flash player window but when you use it in a html document it does not load past the first frame. Can anyone help? Am I missing something? Any insite would be greatly appreciated!


PHP Code:



var banners:Array = new Array("flmovie1.swf", "flmovie2.swf", "flmovie3.swf");
    function randomBanner() {
        var randomNumber = random (banners.length);
        loadMovieNum (banners[randomNumber],0);
    }
    randomBanner(); 

Random Random Random Timer... Problems
Heyy guys. I know you guys know this stuff backwards & forwards so maybe you can help.

This is a 2 part problem. Part 1 is Im trying to create a timer that functions at random intervals, the function in this case is playing a MC of a car driving on a freeway in 1 to 10 second intervals to give the feeling of, well, randomness. (I've attatched the .fla file if that'll help).

So it works, but not quite as it will generate intervals only twice before it repeats the second interval over and over. So the car will 'drive' in say, 7 seconds the first time and then it will drive in 3 seconds, then again in 3, and in 3 and in 3 seconds. Ive tested it so much I know its not coinsidence.

Here's the code Im using (located in the freeway MC):

var interval:Number = random(10)+1;
function someCodeToRun() {
_root.freeway.diffcars.drive01.gotoAndPlay(2);
}
setInterval(this, "someCodeToRun", interval*1000);

Part 2 is I also wanted the cars to be different colors, which is why there is a diffcars MC with different frames of cars, but now Im not even sure I was headed in the right direction with that.

Ultimately Id love to have different colored cars driving on the freeway at different intervals. Can anyone figure this out?

PLEASE HELP - URGENT Load Random Swfs From Individual Random Sets
I have two target mcs I would like to load different random swfs into

I have eight folders (a-h), each with 12 swfs (001-012)

I need to load a random swf (001-012) from a random folder (a-h) into the "card1" mc

I have figured out how to specify which one I want:

loadMovie("a/a001.swf","card1")
stop();

however, I need it randomized....

then, I need to load another random swf into my "card2" mc (001-012) from another random folder (a-h, ...except for the folder from which the first swf was loaded)

can somebody please help??????

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