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








[Flash MX 2004] Daft ClipEvent + If Statement Problem :(


hi, ive been playin around again not got stuck on a simple clipEvent + if statement bit, its really quite daft, but why it doesnt work is beyond me?

Theres an MC (lecafe) with a button in on the main stage, the button is in an MC itself (logons) with two different states (on-in + off-in). when the clip hits a certain frame the status changes to off. so once the status has changed, the button in the logons MC should change 2 the 2nd state.

if u dont quite get what i mean, check it outhere

After the lil log in movie the icon fades and returns (top left corner) once u click it again the text in the window should then say "Log Off?". - But it dont :'(


Code:
onClipEvent(enterFrame) {
if(_root.status.equals("on")) {
_root.lecafe.logons.gotoAndStop("on-in");
}
else if(_root.status.equals("off")) {
_root.lecafe.logons.gotoAndStop("off-in");
}
}


what i have at the moment (above) works for the first test but not the second. ive tried using different methods such as


Code:
_root.status = "on";


and different types of if's. im not sure if when u use an 'else if' u have to include an 'else' to catch the exceptions.

Ive tried and tried n finally decided to come worship at the holy Flash Kit Shrine and ask for your wisdom. can anyone help?




FlashKit > Flash Help > Flash ActionScript
Posted on: 04-16-2004, 11:55 AM


View Complete Forum Thread with Replies

Sponsored Links:

Help - Explanation Of The Statement From Flash MX 2004
Hi,

I'm going to give a presentation regarding Flash MX 2004 in our Mac meeting.

When I was reading some information from Macromedia site, I cannot understand this...


Quote:




Leverage the strength of the Flash community with the application’s new extensible architecture.






Can you explain it and how can it be done? I don't want to sound uneducated when given a speech.

Also, do you guys have any recommendations for some beginners and advanced users?

Please advise and thanks,

Leigh-Anne

View Replies !    View Related
On Clipevent In Flash 4
Hi,
Is there a way to perform the same action as the "On Clipevent" from flash 5 in flash 4?

View Replies !    View Related
I Know This Is A Daft Question...
...but for the brand new and shiny Flash MX, how would I get a button to open up a new browser?

Supposing I want to open up google, what would the actionscript for the button be?



Thanks!
~Nudger

edit : Forgot to mention, I'm using Flash MX 2004 normal edition.

View Replies !    View Related
Help Me With Daft Circles
Hello I can't get the following to work, it very simply sends some moving circles across the stage - but the problem is it really slows down the FPS and starts to corrupt the screen/browser. The function is certainly the culprit.

I came up with this code to try and remove onEnterFrame, but my issue is calling onEnterframe when the movie clip reaches a certain position on the stage, which is not working. this is wrong:


Code:
if (this.circle2_mc._x = -250)
I want to call the function below with an onRelease then when it reaches a certain position unLoadMovie and/or delete OnEnterFrame.

Would it be better to try and acheive this using a time/duration function?

Heres my code:



Code:
function movecirc ()

{attachMovie ("mccircle", "circle2_mc", 1)

_root.sq_mc.circle2_mc.onEnterFrame = function ()
{this._x += -15;}
if (this.circle2_mc._x = -250)
{this.circle2_mc.unloadMovie();
delete this.onEnterFrame ;
trace("deleted");
}
}
Thanks ery much in advance!

View Replies !    View Related
Clipevent Help
please indulge me if you have read this before but i'm really stuck... sorry it's long, just trying to be thorough...

i'm doing a flash presentation and want it to function the same way as a ppt presentation (user hits the space bar, it advances forward, back key and it goes back one).

I know you can easily do this with buttons, but I was trying to avoid that. So i tried using a clip event (the different sections of my presentation are built in movieclips) that states:

onClipEvent (keyDown) {
play ();
}

The problem is when it gets to the end of that movie clip, it just goes back to the beginning of the same one (mc) and starts to play it over again. I want it to advance to the next movieclip on the main timeline. I'm not sure how to get the clipevent to recognize when it is at the end of the designated movie clip and begin playing the next mc.

Is there some other action I could be using? Do I need to set this up in a different way?

PLEASE HELP ME!

View Replies !    View Related
SetInterval Within ClipEvent?
Using Flash MX, can you call a setInterval within an onClipEvent (enterFrame) on a MC? I've tried testing this and it won't work.

View Replies !    View Related
ClipEvent Not Counting Right
I have a quiz built using the flash interactions and it's great. I have it plugged into my LMS and everything is tracking wonderfully except my results page.

I have 3 dynamic text fields on stage, and I want them to display how many right, how many wrong, and percentage.

Now....

When the user clicks a choice in a multiple choice for example I have this code:

onClipEvent(mouseUp){
_global.wrong = _global.wrong += 1;
}

The problem is whenevr the mouse is clicked on any frame this value gets added to. So in the end it will say 10 wrong out of 5.

I want a variable named wrong and a variable named right to be added to only when the user clicks the distractor.

I'm I making sense?

-Lemorris

View Replies !    View Related
Function/clipEvent Help
I have 2 movieclips on my stage (box_mc, box2_mc), each contains a button(my_btn). box2_mc starts off with an _alpha of 0 while box_mc starts off with an _alpha of 100. When a button in box_mc is pressed it will fade box2_mc in and fade box_mc out and vice versa. What I would like some help with is creating a function that will fade 1 movie clip out and when that clip's _alpha has reached 0 it will start to fade the other clip in. Any help with this would be great. Here's my code so far:
code:
var fadeBox:Number;
var fadeBox2:Number;
box_mc.my_btn.enabled = true;
box2_mc.my_btn.enabled = false;


box_mc.my_btn.onRelease = function() {
box_mc.fadeBox = 0;
box2_mc.fadeBox2 = 100;
box_mc.my_btn.enabled = false;
box2_mc.my_btn.enabled = true;
}
box2_mc.my_btn.onRelease = function() {
box_mc.fadeBox = 100;
box2_mc.fadeBox2 = 0;
box_mc.my_btn.enabled = true;
box2_mc.my_btn.enabled = false;
}

clipEvent
code:
onClipEvent(enterFrame) {
_alpha += (fadeBox - _alpha) / 5;
}
onClipEvent(enterFrame) {
_alpha += (fadeBox2 - _alpha) / 5;
}

View Replies !    View Related
ClipEvent Problem
I need some help with a clipEvent. Right now I have two clips(clients_display_mc, work_thumbs_mc) fading out, when the clip is faded out another clip(content_area_mask_mc) slides into position. Once that clip has reached it's new _x spot I want another clip(work_mc) to fade in. Currently I have the first two clips fading out fine and the second clip sliding into position, but I can't get the last part of my clip even to fire telling the last clip to fade in. Any suggestions would be greatly appreciated.


Code:
_root.checker_mc.onEnterFrame = function() {
if (_root.content_mc.clients_display_mc._alpha > 0) {
_root.content_mc.clients_display_mc._alpha -= 10;
_root.content_mc.work_thumbs_mc._alpha -= 10;
} else {
_root.content_mc.content_area_mask_mc.endX = 10;
if (_root.content_mc.content_area_mask_mc._x >= 10) {
_root.work_mc._alpha += 10;
if (_root.work_mc._alpha >= 100) {
deletethis.onEnterFrame;
}
}
}
};

View Replies !    View Related
ClipEvent To Function
Hi,

I have used the following onClipEvent to move a menu according to the x position of the mouse:


Code:
onClipEvent (load) {
xcenter = 250;
speed = 1/15;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x -= (distance*speed);
if (_x>0) {
_x = -500;
}
if (_x<-500) {
_x = 0;
}
}
Is this script also possible in a function and if yes how does that function look likes .

Thanks in advance

View Replies !    View Related
Screed Against On(clipEvent)
I am continually amazed at the number of people who are just now coming to Flash (or have only just started learning a bit of Actionscript) and post questions regarding on(someClipEventOrOther). I'm trying to understand who and/or what is guiding them to using this type of pre-Flash MX (6) style of coding.

Flash 6 was released early in 2002 and introduced all the MovieClip.onSomeClipEventOrOther events. The benefits of being able to put all your code in one place (or at least in more controlled places) and not having to search around to make changes are truly amazing. Personally I haven't used the on(clipEvent) structure since 2002. And I suspect that most folks here who do a lot of development use it very sparingly if at all? Am I correct in this assumption?

Personally I seldom answer questions that involve that kind of code because I just don't remember all the in-outs-and-little-tricky-bits about using it. Scoping issues, does the clip exist at the correct time, what is the path from it to other things on the stage, what is their code and properties, etc. It just gets too hard to debug and follow when it is so broken up. Or maybe it is just me?

I'm just trying to start a community dialog about this and am wondering if there is someway we can encourage/lead new folks to not using that style of coding? Or does everyone think that it is a good thing?

PS: I used to be crazy and rabid about the use of _root, and I would just like to point out that we don't seem to have so many questions that revolve around _root anymore, now do we? :)

View Replies !    View Related
Refresh ClipEvent
Hello:
I have a blank container mc into which I am loading JPGs after you click on a button.
There are 10 buttons in the movie, each associated with a different JPG.
This container_mc is part of a function called on the main Timeline.
The Flash movie is 1 frame on the main Timeline.
This code works correctly on the first JPG when I click on a button for the first time), but then when you click on a different button I believe it just uses the dimensions and coordinates of the first JPG.
How can I reset or refresh (unload, reload?) this function so it works correctly every time I load a new JPG?
updateAfterEvent, maybe?
thanks.
//after full size image loads into detailthumb_mc,
//resize image so that neither width nor height is > 150, tben recenter
onClipEvent(load) {
var maxWidth = 150;
var maxHeight = 150;
if (this._width > maxWidth || this._height > maxHeight) {
var scaleFactor = this._width > this._height ? maxWidth / this._width : maxHeight / this._height;
this._width = Math.floor (this._width * scaleFactor);
this._height = Math.floor (this._height * scaleFactor);
this._x = 85 - (this._width/2);
this._y = 90 - (this._height/2);
//display gallerywm_mc at bottom of resized image
var gallerywm = _parent.gallerywm_mc;
gallerywm._x = this._x;
gallerywm._y = this._y + this._height - 20;
gallerywm._width = this._width;
gallerywm._height = Math.floor (gallerywm._height * this._width /150);
//hide boundingbox_mc if image is portrait orientation
if (this._height == 150) {
_parent.boundingbox_mc._visible= false;
}
//hide imagepreloader_mc
_parent.imagepreload_mc._visible= false;
}
}

View Replies !    View Related
[FMX]clipEvent To Function ?
I have the following clipEvent on a movieclip called square:

onClipEvent (enterFrame) {
xmove = (xpos-this._x)/5;
this._x += xmove;
}

And the following framecode in the same keyframe as square:

_root.square.xpos = Math.round(Math.random()*550);

Now I want to convert this into a function so I can control more than just one clip for the random movement.

Can anybody tell me how this function should look like?

View Replies !    View Related
Need Basic Lesson On 'on ClipEvent ()'
Ok, I've been told a couple of times to use the on ClipEvent() actionscript to do something.

However, if I put it in the main timeline or the movieclip's timeline, it refuses when I export.

Where do you actually put the code?

View Replies !    View Related
ClipEvent For Dynamic Clip
Ok.. I have a dynamic xml menu systmem that I have hacked around from some script that I got from somewhere. I'm trying to convert it to a drop down menu system. I made it so that i you can click to open and click to close each menu but I want it on mouse over. The trouble is the usual way of solving this is...

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.gotoAndStop("over");
} else {
this.gotoAndStop("off");
}
}

but as my menu items are all scripted on to the stage where would I put this code??

View Replies !    View Related
[F8] ClipEvent Handlers Question
I don't consider myself really good at anything. AS is one of those. I am not bad at it, having handwritten about 40,000 lines so far, but there is still so much that I don't truly understand.

Currently I am trying to figure out what is the useful difference between


Code:
onClipEvent(enterFrame){
and


Code:
onClipEvent(load){
I mean, I know the obvious differences, but as far as coding goes I am lost. depending on the need/use of the AS, if I use one and it doesn't work I use the other, but I don't know "why".

Can some one explain the "why"?

~MoN

View Replies !    View Related
Loading A Movie Into A MC Using Clipevent?
Code:
onClipEvent (enterFrame) {
if (_root._currentframe>=_root.thisFrame+1) {
loadMovie("BANNERS/01/01.swf", "this");
}
}
I have this on a mc, but I can't get it to load the file, it works on frame, and loads where I want it, but when I put it on the MC I want it to load into, it stops working, now I know it's some kindof syntax, but so far everything I've tried has failed.

Any ideas?

thanks in advance

View Replies !    View Related
[FMX]Changing A ClipEvent Into A Function
I have the following clipEvent to control a scrolling menu:


Code:
onClipEvent (load) {
xcenter = 250;
speed = 1/15;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x -= (distance*speed);
if (_x>0) {
_x = -500;
}
if (_x<-500) {
_x = 0;
}
}
How can I make this into a function ?

View Replies !    View Related
Variable Value Not Passing To ClipEvent
Frame1:

ActionScript Code:
stop();loadText = new LoadVars();loadText.load("gallery.txt");loadText.onLoad = function(success) { _global.total = this.total; trace(_global.total); gotoAndStop(2);};

Frame2:

ActionScript Code:
stop();MovieClip.prototype.tot = total;MovieClip.prototype.i = tot/2;MovieClip.prototype.j = i;MovieClip.prototype.num = tot;


Attached on a mc (within a mc):

ActionScript Code:
onClipEvent (load) { this._visible = 0;}onClipEvent (enterFrame) { //CODE GENERAZIONE QUARDATI trace(tot); for (var i = 1; i<tot+1; i++) {  e = "foto"+i;  if (i%2 != 0) {   if (i != 1 && i != 2) {    yp = 0;    xp = _parent["foto"+String(i-2)]._x+68;   } else {    xp = 0;    yp = 0;   }  } else {   if (i != 1 && i != 2) {    yp = 68;    xp = _parent["foto"+String(i-2)]._x+68;   } else {    yp = 68;    xp = 0;   }  }  duplicateMovieClip(_parent.foto, e, i);  _parent[e]._x = xp;  _parent[e]._y = yp;  _parent[e].img._xscale = 64;  _parent[e].img._yscale = 64;  _parent[e].foto.n.text = i;  _parent[e].dataa = dataa[i];  _parent[e].link = link[i]; }}


What it does (should do) basicaly is duplicate the mc foto for the value of tot.
The txt file is loaded properly and it does trace the correct value for total and tot but it doesn't duplicate the movie.
If instead of

ActionScript Code:
MovieClip.prototype.tot = total;

I write

ActionScript Code:
MovieClip.prototype.tot = 10;

Everything works fine.
Any idea why if tot and total trace the right value, the duplicateMovieClip won't work???

View Replies !    View Related
On ClipEvent With Movie Clip....help
Hey, I have a movie clip that has its own timeline animation. When the mouse is clicked on the movie clip, the animation starts and then is removed. So, I can do this easily when the movie clip is dragged on the stage, I click on it and add the on clipEvent(mouseDown) script.
But when the movie plays, I need to have the mc generate on screen a bunch of times. When its in the library, it doesnt have the on clipEvent(mouseDown) script and I cant figure out how to add the script to the mc in edit mode when its in the library, I keep getting errors.
Any ideas?

View Replies !    View Related
[FMX]Changing A ClipEvent Into A Function
I have the following clipEvent to control a scrolling menu:


Code:
onClipEvent (load) {
xcenter = 250;
speed = 1/15;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x -= (distance*speed);
if (_x>0) {
_x = -500;
}
if (_x<-500) {
_x = 0;
}
}
How can I make this into a function ?

View Replies !    View Related
Stop ClipEvent (enter Frame)
Here is my code:

onClipEvent(load) {
badPeanutSpeed=random(4);
function badPeanutReset() {
this._x=random(400);
this._y=0;
this._visible=true;
}
badPeanutReset();
}


onClipEvent(enterFrame){
this._y = _y+badPeanutSpeed+3;
if(this._y >= 300){
badPeanutReset();

basically when this MC loads its giving it a random _x position. the enter frame is telling the MC to fall vertically at a random speed and when it gets the the bottom of my stage to reset to the top with a new random _x position. Its basically a loop. I need to know how to stop it based on other script elsewhere. I need to know how to manipulate the data to either stop the clipEvent (enterFrame) or something. Please help.

View Replies !    View Related
Help Converting Code From A Mc Clipevent To An Array...
im creating a side scrolling game, but instead of a space ship and enemy ships, i have a guy dodging a flower, a cat, and a perfume bottle... so far everything is working fine. the following code example is what i have on the flower, cat and perfume bottle. they are all set up onClip events with random locations and hit test.. HERE THE WORKING CODE....


onClipEvent (load) {
function reset(){
this._x = random(600)+1500;
this._y = random(500)+100;
enemySpeed = 10;
this.gotoAndStop(1);
}
reset();
}


onClipEvent (enterFrame) {
this._x -= enemySpeed;
if (this._x <- 100) {
reset();

}
if (this.hitTest(_level0.guy.hitTarg)) {
_level0.lives--;
_level0.counterDist.stop();
trace("you hit the flowers");
}
lives();
}


what i want to do is consolidate this code(x3 becasue this code example was only from the flower mc) into an array...AM I ON THE RIGHT TRACK HERE???? i need all the randomness and hit.test incorporated into the array..


var numEnemy = ["flower", "perfume", "cat"];

for (var i:Number = 0; i < numEnemy.length; i++) {
flower.duplicateMovieClip( "flower", "flower" + i, i + 100);
perfume.duplicateMovieClip( "perfume", "perfume" + i, i + 500);
cat.duplicateMovieClip( "cat", "cat" + i, i + 1000);
}

View Replies !    View Related
Detect Mouse Click Within Another Clipevent
Hello,

I'm using the following script on a movie clip to produce an animated drop down menu:

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}

This works such that when the mouse is within the boundaries of the movie clip, the menu activates forward and when the mouse leaves the boundaries, the menu activates back to initial state. I'm wondering how to amend this code so that a mouseclick within the movie clip will produce the same effect as leaving the boundaries of the movie.

Example:
movie clip is a menu dropdown...
- user highlights a menu item button within drop down
- user clicks on menu item
- drop down menu scrolls back up even though mouse is still within boundaries

Link to example:
http://www.davegk.com/dropdownmenu.html
source:
http://www.davegk.com/dropdownmenu.fla

Thanks!
David

View Replies !    View Related
Basic Difference Between Flash Mx 2004 And Flash Mx 2004 Professional Version.
Could someone plz point out the basic difference between Flash Mx 2004 and Flash Mx 2004 Professional version?

View Replies !    View Related
Animating A Clip Without Attaching Logic To The ClipEvent OnEnterframe
I need to create a custom scrollbar dynamically and am stuck because usually when I script motion for movieClips I do this:

onClipEvent(enterFrame){

---animation code here---


}

Can anyone show me a few lines of code that are not attached to a movieClips enterFrame Handler. That simply moves a movieClip accross the stage.

For example code that could go on frame 1 or in a .as class file.

Thanks.

View Replies !    View Related
Flash MX 2004/2004 Pro - Bring Back The Old Undo - Petition To Macromedia
Many of you will know that the removal of the movie clip specific undo is causing us enless hassles and this isn't one of those features that we just get used to, this is a serious workflow hindrance.

We have been discussing in this in more detail here if you want to read more first http://webforums.macromedia.com/flas...hreadid=709486

I don't want this thread to become another discussion about it as it has already been done, but I do want to get a petition together of emails or names which we can send to macromedia or maybe they will take notice here, so If you feel the same way that I do then reply here.

View Replies !    View Related
[I]Free Brainbench Flash MX 2004 / Dreamweaver MX 2004 Exams
Got it from one of the blogs and you should try it... I've got one myself... Not sure what I am going to do with it though...


Free Brainbench Flash MX 2004 / Dreamweaver MX 2004 exams ONLY for TODAY

http://www.gunthersoft.com/brainbenc...tional_special

"... ONLY TODAY, that's February 28th, Brainbench certification tests for MacroMedia Dreamweaver MX 2004 and Flash MX 2004 are sponsored, meaning, these tests which are normally $49.95 each are free for the TODAY ONLY!"

View Replies !    View Related
STUCK AGAIN: Move A 'clipevent Code' Into The Main Timeline 'function' - HELP
I wonder if any on can help me here with this...this is my script that is attached to movie clips which ar erandomly placed on the screen and walk about at random angles and speeds.

-------------------------------------------------------------
-------------------------------------------------------------
onClipEvent (load) {
sx = random(4)+4;
sy = random(6)-6;
if (_name != "ganga") {
_x = Math.random()*750+25;
_y = Math.random()*550+25;
this.gotoAndPlay(2);
}
}
onClipEvent (enterFrame) {
if (_name != "ganga") {
_x += sx;
_y += sy;
// these may not be needed if it never just goes in one direction:
if (sx == 0 && sy<0) {
// just up
this._rotation = 0;
}
if (sx == 0 && sy>0) {
// just down
this._rotation = 180;
}
if (sx<0 && sy == 0) {
// just left
this._rotation = 270;
}
if (sx>0 && sy == 0) {
// just right
this._rotation = 90;
}
if (sx>0 && sy == 0) {
// just right
this._rotation = 90;
}
// directions:
if (sx>0 && sy<0) {
// 9
this._rotation = 45;
}
if (sx>0 && sy>0) {
// 3
this._rotation = 135;
}
if (sx<0 && sy>0) {
// 1
this._rotation = 225;
}
if (sx<0 && sy<0) {
// 7
this._rotation = 315;
}
if (_x<25) {
_x = 25;
if (sy != 0) {
sx *= -(random(2));
} else {
sx *= -1;
}
if (random(2)) {
sy = 2;
} else {
sy = -2;
}
} else if (_x>775) {
_x = 775;
if (sy != 0) {
sx *= -(random(2));
} else {
sx *= -1;
}
if (random(2)) {
sy = 2;
} else {
sy = -2;
}
}
if (_y<25) {
_y = 25;
if (random(2)) {
sx = 2;
} else {
sx = -2;
}
if (sx != 0) {
sy *= -(random(2));
} else {
sy *= -1;
}
} else if (_y>575) {
_y = 575;
if (random(2)) {
sx = 2;
} else {
sx = -2;
}
if (sx != 0) {
sy *= -(random(2));
} else {
sy *= -1;
}
}
}
}
------------------------------------------------------------
------------------------------------------------------------
But what I want to do since i'm using MX is put all this into a function on the main timeline...but i can't get it to work! any ideas anyone...the mc are all on the root.

this is what I created, but as I said it doesn't work:

-----------------------------------------------------------------
-----------------------------------------------------------------
function walkFree() {
if (_name != "ganga") {
for (i=1; i<=amount1; i++) {
_x += _root["ganga"+i].sx;
_y += _root["ganga"+i].sy;
sx = _root["ganga"+i].sx;
sy = _root["ganga"+i].sy;
}
// these may not be needed if it never just goes in one direction:
if (sx == 0 && sy<0) {
// just up
this._rotation = 0;
}
if (sx == 0 && sy>0) {
// just down
this._rotation = 180;
}
if (sx<0 && sy == 0) {
// just left
this._rotation = 270;
}
if (sx>0 && sy == 0) {
// just right
this._rotation = 90;
}
if (sx>0 && sy == 0) {
// just right
this._rotation = 90;
}
// directions:
if (sx>0 && sy<0) {
// 9
this._rotation = 45;
}
if (sx>0 && sy>0) {
// 3
this._rotation = 135;
}
if (sx<0 && sy>0) {
// 1
this._rotation = 225;
}
if (sx<0 && sy<0) {
// 7
this._rotation = 315;
}
if (_x<25) {
_x = 25;
if (sy != 0) {
sx *= -(random(2));
} else {
sx *= -1;
}
if (random(2)) {
sy = 2;
} else {
sy = -2;
}
} else if (_x>775) {
_x = 775;
if (sy != 0) {
sx *= -(random(2));
} else {
sx *= -1;
}
if (random(2)) {
sy = 2;
} else {
sy = -2;
}
}
if (_y<25) {
_y = 25;
if (random(2)) {
sx = 2;
} else {
sx = -2;
}
if (sx != 0) {
sy *= -(random(2));
} else {
sy *= -1;
}
} else if (_y>575) {
_y = 575;
if (random(2)) {
sx = 2;
} else {
sx = -2;
}
if (sx != 0) {
sy *= -(random(2));
} else {
sy *= -1;
}
}
}
}
------------------------------------------
-----------------------------------------------------

this is called from in the on clip event within the mc's they also have the top part as there onclipevent load:
----------------------------------------------------------------------
onClipEvent (load) {
sx = random(4)+4;
sy = random(6)-6;
if (_name != "ganga") {
_x = Math.random()*750+25;
_y = Math.random()*550+25;
this.gotoAndPlay(2);
}
}
onClipEvent (enterFrame) {
walkFree;
}
------------------------------------------------------------------------

please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!STU

View Replies !    View Related
Newb Problem Counting MouseMoves (as ClipEvent To Load Random Swfs)
help required please - have tried diy through searching threads but can't do it by myself !

i have an empty movie clip (instance name random_fink) on the stage into which i am randomly loading swfs from a bank of 10 (named fink_1, fink_2 etc) using


ActionScript Code:
onClipEvent(mouseMove) {

var num_finks = 10
var finkName = "fink_" + Math.floor ( Math.random( ) * num_finks);

_root.random_fink.loadMovie ( "fink_" + Math.floor ( Math.random( ) *
num_finks);

}

at the moment this happens in scene1 - i want the user to move the mouse ten times ie ten random swfs to run, before the movie goes to the next scene

i think this is quite complicated and i'm no a.s. genius - just self taught as i go along - HELP !!!

View Replies !    View Related
Integrate Flash MX 2004 And Director MX 2004
This is a dedicated thread for discussing the SitePoint article 'Integrate Flash MX 2004 and Director MX 2004'

View Replies !    View Related
Difference Between Flash MX 2004 And MX 2004 Pro
What exactly is the advantage over MX with MX Pro?

View Replies !    View Related
Flash MX 2004 And Dreamweaver MX 2004
Please help,,, Im doing a flash AD. when you click on the add it disappers... now when i run i through my webpage done by Dreamweaver it dosent disapper or clear... this is the webpage address http://users4.ev1.net/%7Esuzuki9/
this is what i write but it doesnt close or quit...

on(press){
fscommand("quit");
}

anyone has an idea how to do it....
by the way when i run this flash movie by itself as SWF and press on it it works i mean close, but from Dreamweaver it doesnt.....

View Replies !    View Related
Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails.
[Flash CS3 (Flash 8 available as well)]
[Actionscript V2 (AS3 Not available for this project. End result must be in AS2. Plus I haven't learned AS3 yet)]

Hi

Sorry about running two posts so close together, but I couldn't change the other one to reflect the changes I've made in my problem.

The 1st post dealt with my theory that my IF statement wasn't written correctly, and so failed. But I've since disproved that.

Okay here is the situation.
I isolated elements from a larger app that I'm putting together and the problem still followed.
The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.
The purpose of the application is to load an XML file(works)
Populate 2 text fields with information from the XML file(works)
Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {

data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {
if (success) {
//point to the first node with information
var track_xml = data_xml.firstChild;
//loop through each node
while (track_xml != null) {
//print out each node
test1 = track_xml.toString();
//point to the next node
track_xml = track_xml.nextSibling;

//Runs my code

//Define the contents of two text fields located in the movie
textOne = data_xml.firstChild.childNodes[3].firstChild;
textTwo = data_xml.firstChild.childNodes[5].firstChild;
trace("data_xml.firstChild.childNodes[3].firstChild = " + data_xml.firstChild.childNodes[3].firstChild);
trace("data_xml.firstChild.childNodes[5].firstChild = " + data_xml.firstChild.childNodes[5].firstChild);
/*dummyYes = data_xml.firstChild.childNodes[5].firstChild;
dummyNo = data_xml.firstChild.childNodes[6].firstChild;
dummyMaybeEmail = data_xml.firstChild.childNodes[3].firstChild;
dummyMaybeFax = data_xml.firstChild.childNodes[4].firstChild;*/

//Checks between the two text fields for a match
if (textOne == textTwo) {
trace("It is selected!" + textOne + " " + textTwo);
check_fax.selected = true;
} else {
trace("Ir is NOT selected!" + textOne + " " + textTwo);
check_fax.selected = false;
};


}
} else {
trace("error reading file");
}

delete data_xml;

};

data_xml.load("XML/dummy2 - email.xml");

};
After you read the code, you'll have noticed the trace commands I stuck in there.
They send this to the output panel:

Code:
data_xml.firstChild.childNodes[3].firstChild = 1
data_xml.firstChild.childNodes[5].firstChild = 1
Ir is NOT selected!1 1
So as far as I can see, it reads the XML file with no problems, it loads the text fields with no problem. But for some reason the IF statement refuses to recognize that both the XML nodes contain the same information.

If I alter the code like so:

Code:
textOne = 1;
textTwo = 1;
Then the IF statement works. It sees that the two text fields are identical in content, and the checkbox is selected.

So whats wrong with the Data from the XML file?
I haven't a clue.
I tried converting from a string to a Numeral using:

Code:
newText = Number(textOne);
But that didn't work, it just produced "NaN" when traced.
I tried populating the XML file with text versus numbers, still no luck.
What came from the trace:

Code:
data_xml.firstChild.childNodes[3].firstChild = hi
data_xml.firstChild.childNodes[5].firstChild = hi
Ir is NOT selected!hi hi
The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.
CheckBoxes are mandatory.
But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

I'd really appreciate some help and suggestions with this, I think I'm out of ideas.

Thanks

-Lem

View Replies !    View Related
Problem With Continue Statement And Label Statement
What am I doing wrong?

ActionScript Code:
var a = {
    a:[1,2,3,4,5,6,7,8,9,0],
    b:[1,2,3,4,5,6,7,8,9,0],
    c:[1,2,3,4,5,6,7,8,9,0],
    d:[1,2,3,4,5,6,7,8,9,0],
    e:[1,2,3,4,5,6,7,8,9,0],
    f:[1,2,3,4,5,6,7,8,9,0],
    g:[1,2,3,4,5,6,7,8,9,0]
}

outerLoop: for(var i in a){
    trace(i);
    for(var j in a[i]){
        trace(' '+j);
        continue outerLoop;
    }
}


Quote:




1039: Target of continue statement was not found.

View Replies !    View Related
Flash MX Pro 2004 Covered Flash MX 2004 ?
Hi there,

I would like to buy the new release...but I am not sure all the features of Flash MX 2004 are incoulded in Flash MX Pro 2004 ?

I know Flash MX Pro 2004 is great for video part.....If so, I can buy the pro only ( not both of them Cheers )

have a nice weekend

View Replies !    View Related
Flash Mx 2004 Or Flash Mx 2004 Professional
flash mx 2004 or flash mx 2004 Professional

i was working on Macromedia flash mx in my pvs job .. office and did applications / sites bla bla for my boss n his clients ..

i ve planned being a free lancer and work on off shore projects ..

for my work now i want to invest on buying macromedia mx studio

for which i have arranged funds ..

i d/l a trial version of macromedia flash mx 2004 professional

.. the problem i faced in it was of writing the script .. part which was all n all in expert mode

and not normal mode

i havent tried macromedia flash mx 2004 cheaper version


if any one of u have tried it .. does it support writing script in normal mode ??

which package shud i invest my money on ..

a) studio mx 2004 with flash mx 2004 professional or
b) studio mx 2004 with flash mx 2004

...

thnx for reading this ...

View Replies !    View Related
Flash Mx 2004 Or Flash Mx 2004 Professional
flash mx 2004 or flash mx 2004 Professional


i was working on Macromedia flash mx in my pvs job .. office and did applications / sites bla bla for my boss n his clients ..

i ve planned being a free lancer and work on off shore projects ..

for my work now i want to invest on buying macromedia mx studio

for which i have arranged funds ..

i d/l a trial version of macromedia flash mx 2004 professional

.. the problem i faced in it was of writing the script .. part which was all n all in expert mode

and not normal mode

i havent tried macromedia flash mx 2004 .. the cheaper version


if any one of u have tried it .. does it support writing script in normal mode ??

which package shud i invest my money on ..

a) studio mx 2004 with flash mx 2004 professional or
b) studio mx 2004 with flash mx 2004

...

thnx for reading this ...

View Replies !    View Related
Decision -- Flash MX 2004 Or Flash MX 2004 Pro.
Hello everyone. I am new to programming period, and to the Flash enviroment. I am currently training myself on actionscript 2.0. I am also training myself on Flash MX 2004. Now that I have made you aware of my lack of knowledge I will continue with the main question.

I need help with a decision, and that is which version of Flash to purchase. Flash MX 2004 or Flash MX 2004 Pro?

View Replies !    View Related
Decision -- Flash MX 2004 Or Flash MX 2004 Pro.
Hello everyone. I am new to programming period, and to the Flash enviroment. I am currently training myself on actionscript 2.0. I am also training myself on Flash MX 2004. Now that I have made you aware of my lack of knowledge I will continue with the main question.

I need help with a decision, and that is which version of Flash to purchase. Flash MX 2004 or Flash MX 2004 Pro?

View Replies !    View Related
Flash MX 2004, Flash MX 2004 Pro Or MX Studio
Hi,

I am still on the 30 days trial with Flash MX 2004 and I wonder what would be the best choice for me when I go on buying it. Should I buy Flash MX 2004, Flash MX 2004 Pro or MX Studio. I want to create animations and games for my web site. I wonder if the other softwares of the MX Studio would really be useful. I already own Photoshop so I guess Firework would be of no use. Is there other softwares that I may need to create animations and games?

Thanks,

Richard

View Replies !    View Related
Flash MX 2004 Vs. Flash MX 2004 Professional
Hello all,

I have a question. I've been using Flash MX 2004 Professional at work for a couple of Flash movies that I put on the Optim Electronics website. Now, since I put up a Flash examples page that has examples of various Flash techniques, I would like to show my supervisor what Flash is capable of doing. However, you can only download the Flash MX and MX 2004 versions of the Flash source files at the Flash Downloads web page. Will Flash MX 2004 have problems opening the Flash MX 2004 file?

Thanks in advance,

View Replies !    View Related
How Do You Convert Flash Mx Pro 2004 To Flash Mx 2004
I bought some flash templates the work with flash mx 2004 but not the pro version. So now I need to use flash mx 2004. I tried uninstalling and deleting the registry, then installing again, but I dont get the option to choose anymore.

View Replies !    View Related
Flash MX 2004 Professional > Flash MX 2004?
I'm looking to buy one of Macromedia's products within the next few days. Problem is, I'm not sure which to buy. This question is aimed at Disjuku (remember me? ) in particular, since Disjuku visited a site mentioned in my previous post. (The site is http://www.square-enix-usa.com/seui/index.htm - you'd have to register (don't worry, it's free) to see what I'm talking about. Go to "ONLINE GUIDES" then "FINAL FANTASY X".) OK, so what is Macromedia's best product to create this site that was obviously created using Flash? Flash MX 2004 seems obvious, but I don't know if Flash MX 2004 Professional is worth the extra money. (By the way, Studio MX 2004 is a little (well, waaay) out of my price range). Anybody have helpful solutions? Thanks.

View Replies !    View Related
Flash Mx 2004 Or Flash Mx 2004 Professional
i was working on Macromedia flash mx in my pvs job .. office and did applications / sites bla bla for my boss n his clients ..

i ve planned being a free lancer and work on off shore projects ..

for my work now i want to invest on buying macromedia mx studio

for which i have arranged funds ..

i d/l a trial version of macromedia flash mx 2004 professional

.. the problem i faced in it was of writing the script .. part which was all n all in expert mode

and not normal mode

i havent tried macromedia flash mx 2004 cheaper version


if any one of u have tried it .. does it support writing script in normal mode ??

which package shud i invest my money on ..

a) studio mx 2004 with flash mx 2004 professional or
b) studio mx 2004 with flash mx 2004

...

thnx for reading this ...

View Replies !    View Related
Converting 'If Else' Statement To A 'switch' Statement
I am attempting to convert the following If statement to a Switch statement and I'm unclear as to the details of the execution of it. If someone could help me with this I would be very grateful. Here is the If statement followed by the shell of my attempted switch statement. TIA.

var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;

btn.onRelease = function() {
f (spotOne) {
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
} else if (spotTwo) {
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
} else if (spotThree) {
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
} else {
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
}
};
---------------------------------
(attempt at conversion to switch)

var spotOne:Boolean = true;
var spotTwo:Boolean = false;
var spotThree:Boolean = false;
var spotFour:Boolean = false;

btn.onRelease = function() {
var location:Number = ?

switch(location) {
case spotOne:
ball.slideTo(450, 100, 1);
spotOne = false;
spotTwo = true;
break;
case spotTwo:
ball.slideTo(450, 150, .5);
spotTwo = false;
spotThree = true;
break;
case spotThree:
ball.slideTo(100, 150, 1);
spotThree = false;
spotFour = true;
break;
case spotFour:
ball.slideTo(100, 100, 1);
spotFour = false;
spotOne = true;
break;
}

View Replies !    View Related
If Statement (Flash 5)
Hello all. I have a movie set up to check the mouse position and then if the mouse position is at a certain _y position it moves an MC to a designated _y position.

Simple enough and it works. However I am now trying to get the if statment to execute more than one thing if a _y position is true and it is not working. I think I just don't know the syntax and any help is greatly appreciated.

Here is the code I am using:

onClipEvent (enterFrame) {
if (_ymouse<0) {
_level0.all.toy = 6;
gotoAndStop(110);
}
}
onClipEvent (enterFrame) {
if (_ymouse>150) {
_level0.all.toy = 6;
gotoAndStop(110);
}
}

The gotoAndStop(110); is not working but the _level0.all.toy = 6; is.

Again any help is greatly appreciated

View Replies !    View Related
Help Php -> Flash + If Statement
Hi,

I hope someone could help me out with the following because i've been trying to get this right for quit some time now but cant seem te get in working.

I have a menu in flash that i would like to check on loading if a user is logged in on the website and display a different menu when a user is logged in.

I already tried the following without any succes:

Frame 1:

loadVariablesNum("http://MY WEBSERVER/checklogin.php", 0);

Frame 3:

if (login == 2) {
gotoAndStop(4);
}
if (login == 1) {
gotoAndStop(5);
}
gotoAndPlay(2);


In frame 4 i designed the menu that has to be displayed when a user is logged in, in frame 5 a menu that has to be displayed when a user is not logged in.

The checklogin.php file contains the following code to test is a user is logged in(if a session variable is set) and prints the correct variable.

<?php
session_start();
if (isset($_SESSION['UserID']))
{
echo "login=1";
}
else
{
echo "login=2";
}
?>

My script now just keeps looping the first frames. It doesn't seem the go through the if statements.
I tried using a .txt (for testing purposes) containing only the following line:
login=1
This text file DOES work.


I have really had it so I hope someone can help me out soon!!
Many thanx in advance!


Greetings

Daan

View Replies !    View Related
If... Else Statement, In Flash 4
I am trying to make this code I got from a tutorial to work on MX, but having trouble... can anybody help? Just need the proper structure of if else if else and I will be on my way.

code:
on (release) {
if (!form-email.length || submit-email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}
else if (!form-name.length) {
EmailStatus = "Please enter your name";
}
}
else if (!form-subject.length) {
EmailStatus = "Please enter a topic";
}
else if (!form-body.length) {
EmailStatus = "Please enter your comment";
}
else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Delivering eMail...";
}
}


EDIT: Added [ as ] tags - see posting guidelines at the top of the forum. jbum

View Replies !    View Related
[MX] Flash IF Statement &*%^$
Hi Folks,

very new to flash, learning lots, traditional procedural programmer (i.e. Turing in the 80's)

The following piece of code is not the program, just the part I am having trouble with.

I want the code to enter the "else" section, but it does not

var ticks = 10;
var m = 3;
var b = 1;
var numbpt = 0;
y = ticks;
x = (y-b)/m;
if ((x>-ticks) && (x<ticks)) {
numbpt = numbpt+1;
if (numbpt=2) {
point2x = x;
point2y = y;
trace("numbpt=2 business");
} else {
trace ("Should be here, but not!!!!");
trace(x);
trace(y);
point1x = x;
point2y = y;
}
}


Any help would be appreciated.

jtp

p.s. Program is a game that involves plotting y=mx+b equations on a grid

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved