AS3 Short Program Problems
Ok so i am trying to make a simple drag and drop program. I've done it alot in as2, but cant seem to do it in as3. I've uploaded the file for anyone who cares to look, but i think i'm just completely doing this wrong. For one thing, the swf wont play right in internet explorer 7.0, but it will play right in firefox. Also when the user finishes dragging all the draggable movie clips, they are supposed to dissapear, but do not. And the code for my buttons is all over the place and i dont think thats right either, but i'm used to as2 where you can place it anywhere. Its a total mess. Can anyone tell me what i'm doing wrong.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 12-29-2008, 02:29 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
As3 Short Program Not Working
Hey everyone... i'm trying to learn as3 and am doing a quick drag and drop program. I have done dozens of these in as2 but am lost with the new structure of as3 and where to place the code. In as2, i could just place the code on each frame that i need it on, however with as3, its not working right when i do this. As you can see from the file, i have tried to do this like i would with as2, but it seems greatly inefficient and i know this is not the proper way. Where do i place my code with as3 and how come this doesnt work with the way i have it? Any help would be greatly appreciated.
Can I Pass Log-in Parameters For A Webmail Program, Past CPanel Program?
Hey all.
I only have a working knowledge of actionscript, so sorry for any bad questions.
My personal website uses cPanel for configuration/management and a free webmail program called Horde. Both are great, but accessing them is a pain. I was wondering if there was some way (either through flash or javascript) to bypass the cPanel log-in screen and the horde log-in screen.
For example, currently when I open my webmail program (www.---.com/webmail), Internet Explorer automatically prompts an "enter username and password" box (same prompt for any ftp or secure access through explorer). This acts as an automatic input for cPanel.
If the input is correct, cPanel grants me access to the webmail log-in screen, and all the necessary log-in info (name and password) is already filled out, waiting for me to press enter/submit. If the input on the IE prompt is incorrect, I am taken to the cPanel log-in screen to correct my grave errors. Once I input and submit the correct info, I am again taken to an already-completed Horde log-in screen. In other words, I have to go past two log-in screens and press enter twice.
Note - The Horde webmail program is installed on the server, not my rented account. Therefore I cannot modify or, in general, access any program files. Everything is done through the cPanel program. Moreover, I cannot access the Horde-specific log-in page in any way, I must go through cPanel (or IE's prompt for the cPanel log-in info). However, the given address of the Horde log-in screen is http://www.---.com:2095/horde/index.php. But opening this url takes me to the cPanel/ie login.
I think that there is some way of passing parameters from input in a flash swf to a php/sql program. Can I automatically log into my webmail program, bypassing cPanel? Am I hopeless, worthless ), or is there some magic way to do what I want???
If anyone wants to help but needs more explanation or examples I will be more than glad to assist.
Big thanks.
Better Program To Program Flash In ?
I`m sick and tired of flash not having the option of hiding functions in my classes , you know those PLUS and MINUS to hide a function , this make my code so long ! is there any way ?
Put Me On The Short Bus
I am having a problem with a drop down menu that I am trying to make. I want 6 or so buttons across the mc, that are set at _alpha=40. On rollover, i have a script that sets the alpha to +1 until it gets to 80, and then on rollout, back to 40 in -1 intervals. Fade in, fade out basically. Anyways, the alpha also effects the children of these buttons, which are set to _alpha=0 initially, and when the parent is rolled over, they set themselves to alpha=60 gradually. If you rollover the children, the alpha increases to 80. There is a dynamic text field over each button as well, which need to be all targeted seperately.
The problem is, Flash does not deal with an onRollover inside of another. It will just ignore it. The parent MC will fade in and show the children, but the children will not respond. I tried yelling at them and everything. How do I do this without having to make 800 different MC's?
Short Job
Would any professional out there be interested in a small 8 -10 second job?
I would like to make an introduction that will play before every cd that I make; the introduction to include my company name and details as well as the logo. This can be just visual and I could add the audio myself.
I'm just beginning to make cd's to be played back on a projector. So far I've just made short presentations for schools. I feel a small intro would add professionalism to my work and perhaps attract more clients.
Waiting to hear.
My email is mail@artistic-desk.co.uk
A Short Question About CGI
Ok, I am in the progress of making a complete Flash Site and I was wondering if it were possible to make a newspro style script run into flash. BTW im running Flash MX!
Newspro is a CGI script which allows you to post news into a series of boxes eg: Title, Username, Etc.
Basically a Message Board but for Admins Only, to allow them to display the web news without having to upload anything!
A link to a newspro Zip is here:
http://members.optusnet.com.au/maste...newspronew.zip
Hope you can help me:
Thanx in advance
Long, But Short
I can't get this to work.
Here's what I'm trying to do:
I have a clip on the stage called can. I need to duplicate this clip 99 times so that there are 100 on the stage. There needs to be 4 rows with 25 clips in each. Like the layout below, with the clips in place of the asterix's.
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
So I start with one clip on the stage at the top left of the layout. It's co-ord's are (x20, y20). Each new clip needs to be placed 20 pixels to the right of the previous. So the first clip to be duplicated needs to have co-ord's of (x40, y20) and so on. When the first row is full (24 duplicates + the original) the 25th duplicate needs to have co-ord's of (x20, y40) and then continue in the same fashion as the top row. When there are 100 clips (99 duplicates) on the stage the _root playhead needs to move on.
I could do this easily enough without scripting, but I need to increase my skills in this area.
I have these two variable initiated in the first frame of the _root timeline:
howMany = 0;
whereX = 20;
In the next frame of the _root timeline I have a stop (); command. This is where I have my can clip placed on the stage. The code I have on this clip is:
onClipEvent (enterFrame) {
this.duplicateMovieClip ("can", "can" + howMany, howMany + 50);
_root["can" + howMany]._x = whereX;
whereX += 20;
howMany += 1;
}
I know that this won't help with moving the 25th duplicate to the second row but I thought at least it would be a start - however nothing happens.
Can anyone offer any assistance please.
Thanks for your time,
Stephen.
::: Short Question :::
A button that when is clicked, the whole page close!
I need this becaue my site is on Fullscreen mode and you cant see the
close button!
I need a script to do that button from Flash or...how to make it in Dreamweaver.
Short Pause
i made a movie clip, and put a small sound loop in it, but when i run the movie, theres a short pause before the clip loops over... how do i make it loop smoothly?
Short Question
Hate to sound ridiculous on my first post but..
I've been working with flash off and on for about 3 years now making short cartoons and such. I just recently decided to get into designing websites and making games with it. I've never messed around with the actionscripting much other than for preloaders and zooming in and out and was wondering if someone could suggest some good books on creating games and has good explanations of actionscript.
Thanks
Two Short Questions
Hello, ive got flash mx and ive got to short questions:
1. I read the tutorial about "manipulating" projector files, but there wasnt said how to make a projector start in 100% and full screen, can you help me?
2. I want to code for different solutions, but I cant change the document size at the different scenes, help?
Thx,
BaSchni
Text Help.. Short
Is there some way to specify a certian letter:
On (press) {
Cat.text=2nd letter of (mat.text);
}
Sort of understand what im asking?
A Short Function...
hello,
basically i have a button located in a movieClip that is called/at _root.one
On the release of the button, (and after the _root.one movieClip is not being dragged anymore) i want to call a function that will return the _root.one movieclip to its original location.
the button says--
on (release) {
stopDrag();
_root.returnIt(this._name);
this._alpha = 100;
_root.drag1 = "false";
}
the function located at the _root timeline says--
function returnIt(theMC) {
_root.theMC._x=50;
_root.theMC._y=50;
trace("trying to return");
trace(theMC);
}
-----
The trace("trying to return") does output in the 'output window', and trace(theMC) outputs "one" with no quotes.
thanks much.
Short AS Not Working?
I have used this script many times and now in this new fla. it is not working.
It allows you to click on an "object" turning red, if its red and you click on it again,the object turns blue(basically togglees between the two colors). The "labels" in each MC are correct as is the "instance" names.
Can you see anything?
thanks
code:
on (press) {
count = (count+1)%2;
count ? _root.MC_P_FoglampSW.gotoAndStop("Off") : _root.MC_P_FoglampSW.gotoAndStop("On");
count ? _root.MC_FoglampCircuit.gotoAndStop("Off") : _root.MC_FoglampCircuit.gotoAndStop("On");
}
Short 3D Animation
Does anyone have the time and the program, such as Swift 3d, that can help me create a short animation for my site, It won't take long at all and I have used a 3D editor before and what I am wanting to accomplish is very simple.
What I need is a an animation that plays like the jpeg shown, the text is just there to show that the box is 3D I do not want the text in there, just the outline of a rounded corner box like the one displayed in the picture. Thanks for your time!
[F8] Short Question
I am wondering, is there a way to turn layers on and off with actionscript?
if there is, please post the code. THANKS!!
Following Short-info
Hi,
does anybody know, in this example, how to let disappear the shortInfo again?
It appears on rollover (over the wave drawing) and disappears again on the next rollover, but it should disappear on rollout instead. (you can find the code implemented so far under actions and the wave button).
Many thanks in advance, best,
flo
So... I Ride The Short Bus :(
Alright so.. I'm going along working on a project, things are going as well as can be expected... and then boom! it breaks! I have spent a couple hours looking at this. I know its simple. But I cant find the breakage.
The previous state which works is found at http://www.embyrs.com/~rosspnt
I couldnt go back to the last good save point...
So the .fla file that is now broken can be found at
[Agent Karl]Edit: I took the file down... now that it works....[/Agent Karl]
Most of the content I am refering to occurs at frame 61 for reference-
Notice how as soon as the site finishes fading in/animating... content appears from the movie clip myContent found on the content layer. This is because on the "other actions" layer I have a line that says _root.myContent.gotoAndStop(2);
the object refered to as myContent is found in the library as ContentArea
Also, the side menu sends the movieClip myContent to the right menu based on....
on (press) {
_root.myContent.gotoAndStop(3);
_root.myContent._y = 491;
}
In the now version- the myContent movie is getting stuck at frame 1 (which is an almost blank frame other than a really opaque background) and not obeying!
None of the external commands for telling myContent where to go are working. Including the side menu buttons found on the side menu layer (click on one of the buttons then go to actions)
Also, at the same time, those up and down scroller buttons which scroll myContent under the mask stopped scrolling. The script for those can be found on the layer Scroller Actions.
I am sure this is some obvious something somewhere... ahh.. but I cannot find it. Please help, I'm tearing out my hair here! You folks have been so good to me in the past, thanks for the effort!
Short Delay
Hi. How can I cause a delay between two events happening?
For example, in Frame 1 I have:
loadMovie("movie1.swf", "_root.movieplace");
loadMovie("movie2.swf", "_root.movieplace");
As you can see, the second movie will instantly load, so the first one won't even get a chance to show.
Does anyone know how to add a delay, so that I can have movie1.swf play, and the movie2.swf play right after it's done?
[Assume movie1.swf is about 5 seconds long (therefore a 5 second delay is needed)]
Thanks a lot!
Need Short Code Fix
Im tryind to make flash wait a certain random amount of time at the end of a mc, here's what i wrote:
PHP Code:
i = math.Random()*20+10;
while (true) {
if (i >= 1000) {
break;
}
i++;
}
i dont know what i've done wrong, but im not an AS god so any help will be welcomed (and if there is a nother way with time in seconds i would appreciate, although i havent found anything)
AS Short Syntax Help
New Member here, hey guys.
Need a lil help with ActionScript here.
Example:
if (monkeyBone == "good")
{
var toy = "videogames";
} else {
var toy = "rocks";
}
can be written as
(monkeyBone=="good") ? "videogames" : "rocks";
I find this useful,
I had seen a forum post where I found many such short cuts, sadly lost the link.
Another Example:
if (monkey_behavior == "good")
{
var toy = "videogames";
}
can be written as
if (monkey_behavior == "good") var toy = "videogames";
Does anyone have a link to any such page which lists it all?
Do we have this here?
Can any one of you contribute to this and add more?
Luke
Short Preloader
HI all! I'm new to the forum. I decided to join this Flash forum because of the assume tourtorial Kirupa has (http://www.kirupa.com/developer/mx/p...epreloader.htm). The only thing that I can't seem to figure out about this toutorial is why my bar seems to be shorter when it plays then it is on the stage. MY stage is 320 X 300 and my bar is 230 X 25. I've checked my registration point and it is in the right place I think. Does anyone have any ideas what may cause this? I'm attaching a smaller version of my swf so you can take a look at it if you want. Thanks in advance!
Rotate The Short Way
I'm making a Pacman game, and I'm not so good with my first code. I want the Pacman to rotate to the direction to go. Here is my code for that. The hittest is to stop moving if bumping a wall and the curRect variable is the value of the direction to rotate to.
Code:
var rotSpeed:Number = 10;
function dirListening(){
var paNose = returnGlobal(this.packin.nose);
if(this.dirEcto=="Up"){
if(!this.wall.hitTest(paNose.x, paNose.y, true)) this.packin._y--;
this.curRect = -90;
}
if(this.dirEcto=="Down"){
this.curRect = 90;
if(!this.wall.hitTest(paNose.x, paNose.y, true)) this.packin._y++;
}
if(this.dirEcto=="Left"){
this.curRect = -180;
if(!this.wall.hitTest(paNose.x, paNose.y, true)) this.packin._x--;
}
if(this.dirEcto=="Right"){
this.curRect = 0;
if(!this.wall.hitTest(paNose.x, paNose.y, true)) this.packin._x++;
}
//turn to rotate
if(this.curRect != this.packin._rotation)
this.packin._rotation = this.packin._rotation - rotSpeed;
}
It works just fine, but it only works if I subtract the rotate speed from the rotation. If I try to add the speed to rotation it gets stuck in an infinite spin. So the problem is it will only turn counter clockwise, therefore it will go the long way around like from facing up to facing right. How can I modify the code to go both clockwise directions (the short way) and not get stuck in a spin?
AS Short Syntax Help
New Member here, hey guys.
Need a lil help with ActionScript here.
Example:
if (monkeyBone == "good")
{
var toy = "videogames";
} else {
var toy = "rocks";
}
can be written as
(monkeyBone=="good") ? "videogames" : "rocks";
I find this useful,
I had seen a forum post where I found many such short cuts, sadly lost the link.
Another Example:
if (monkey_behavior == "good")
{
var toy = "videogames";
}
can be written as
if (monkey_behavior == "good") var toy = "videogames";
Does anyone have a link to any such page which lists it all?
Do we have this here?
Can any one of you contribute to this and add more?
Luke
Short Question
I have a series of buttons and I want them when clicked to load another swf and go directly to a particular frame.
I can load the files but only to make them start on frame 1 which I dont want.
Long, But Short
Last edited by Pen : 2003-01-21 at 21:02.
I can't get this to work.
Here's what I'm trying to do:
I have a clip on the stage called can. I need to duplicate this clip 99 times so that there are 100 on the stage. There needs to be 4 rows with 25 clips in each. Like the layout below, with the clips in place of the asterix's.
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * *
So I start with one clip on the stage at the top left of the layout. It's co-ord's are (x20, y20). Each new clip needs to be placed 20 pixels to the right of the previous. So the first clip to be duplicated needs to have co-ord's of (x40, y20) and so on. When the first row is full (24 duplicates + the original) the 25th duplicate needs to have co-ord's of (x20, y40) and then continue in the same fashion as the top row. When there are 100 clips (99 duplicates) on the stage the _root playhead needs to move on.
I could do this easily enough without scripting, but I need to increase my skills in this area.
I have these two variable initiated in the first frame of the _root timeline:
howMany = 0;
whereX = 20;
In the next frame of the _root timeline I have a stop (); command. This is where I have my can clip placed on the stage. The code I have on this clip is:
onClipEvent (enterFrame) {
this.duplicateMovieClip ("can", "can" + howMany, howMany + 50);
_root["can" + howMany]._x = whereX;
whereX += 20;
howMany += 1;
}
I know that this won't help with moving the 25th duplicate to the second row but I thought at least it would be a start - however nothing happens.
Can anyone offer any assistance please.
Thanks for your time,
Stephen.
2^3=8? How? Real Short Question :-)
Hi!
Need help:
Want a random sign! Tested (-1)^(random(2)) - but the "^" doesn't that thing!!!????!!???
What's the real expression?
Thanks
Jan
Please Help Me Write This Short Code...
I want the code to work like this...
------------------------------
Create a random number, 1 or 2
If 1 then play frame 1
If 2 then play frame 2
Repeat
------------------------------
I want this code to randomly play either frame one or two and repeat this process. I know how I want it to work, but I just don't know the correct actions or code to use.
Thanks
A Few Short Questions. Answer If U Can Plz
1) is there an actionscript that you can place in the timeline to make all sound loops fade out? like a volume control of some sort?
2) is there a way to make a dynamic textbox scroll continuously while on mouseover?(mouseover on a scrollbar button)
3) is there a way of checking how cpu-heavy a flash movie is?
Short Validate Question......
Hi!
I need to know if ActionScript will let me validate a flash form using the same syntax as Javascript..i just need to know for one part, to check if my textfield 'E-mail' does NOT contain an '@'...
i am running an intranet, so everyone has the same last part of the e-mail, so there would be no reason to type an '@' in the field...
Basically, if anyone can show me how ActionScript can be used to check for a certain character(s) in any position within the textfield, i'd greatly appreciate it!
thanks!!!
Sound Lenght Too Short
I add a mp3 sound to my scene, but the lenght of the melody is only 33.5 sec.What can I do to have the entire lenght?
Thanks!
Short And Simple Question?
Does having more layers in a Flash movie increase the over all size of the .swf
If so is this a dramatic file size increase or nothing to worry about?
Short Script Problem
I have a movieclip name 'theband.swf' with a stop action in it's first frame. It's second frame is labeled "begin". I'm using this code in another movie to load 'theband.swf' into it:
Code:
loadMovie("flash/theband.swf", "_root.holder1_mc.cover_mc");
_parent._parent.cover_mc.gotoAndPlay("begin");
When I call this code 'theband.swf' doesn't play.
Now I've checked the paths and all and they are correct (when I remove the stop action from 'theband.swf' first frame it plays right away).
I really need the stop action in the first frame for preloading reasons. Any other way I can get this movie to play somehow?
Thanks!
PS - Working on Saturday sucks.
-Foochuck
Short Xmas Animation
I have been asked to do a short movie for a christmas thing. I thought I would be able to put something basic together, but it looks crap. I have searched for some other christmas movies and tried modify them to make it, but I cant get it to look any good.
The movie should go like this -
1. You see houses in snow, then you see santa and reindeers fly above them a couple of times.
2. Camera goes close up on a house and you see santa land.
3. Santa hops out and then climbs down the chimny
So if anyone feels like helping me out by making something basic, it would be greatly apprecitated, and if its good I might even pay a little something for it.
Combining Short Clips
i just wanted to know if anyone here knew how to combine a bunch of shot little clips into one larger movie. any help would be much appreciated.
Help MP3 Sound Cuts Out Short
See www.vewdo.com, side panels with the rollovers... Clicking on each button plays sound clip(mp3)... On some, 3 of the 4 on the right, the sound cuts short on the published movie... it just cuts out the last 5-10 seconds of each... Any reason why? The left side panel was created identically, yet no clipping. I'm a newbie, so this is just simple flash. Any help would be great!
Scrollbar Stopping Short
Hi,
I have a working scrollable text area with scrollbar, including the abiltiy to drag the bar to scroll the text in addition to the up and down buttons. I'm having trouble with the positioning of the bar when using the up and down buttons. When using the up button to scroll all the way back up, the bar stops short. I've attributed this to .scroll never being 0. Of course if I try to counter this by subtracting 1 from .scroll, the bar falls short on it's way to the bottom using the down button. Any suggestions?
scrollPos_btn is the 'bar'.
code:
scrollBar_mc.scrollUp_btn.onPress = function(){
scrolling = true;
scrollInc = -1;
}
scrollBar_mc.scrollUp_btn.onRelease = function(){
scrolling = false;
}
scrollBar_mc.scrollUp_btn.onReleaseOutside = function(){
scrolling = false;
}
scrollBar_mc.scrollDn_btn.onPress = function(){
scrolling = true;
scrollInc = 1;
}
scrollBar_mc.scrollDn_btn.onRelease = function(){
scrolling = false;
}
scrollBar_mc.scrollDn_btn.onReleaseOutside = function(){
scrolling = false;
}
scrollBar_mc.scrollPos_btn.onPress = function(){
startDrag(this, false, this._x, 0, this._x, 225);
dragging = true;
}
scrollBar_mc.scrollPos_btn.onRelease = function(){
stopDrag();
dragging = false;
}
scrollBar_mc.scrollPos_btn.onReleaseOutside = function(){
stopDrag();
dragging = false;
}
contRegion_mc.onEnterFrame = function(){
if(scrolling == true){
region_txt.scroll = region_txt.scroll + scrollInc;
scrollBar_mc.scrollPos_btn._y = ((region_txt.scroll-1)/(region_txt.maxscroll))*225;
}
if(dragging == true){
region_txt.scroll = (scrollBar_mc.scrollPos_btn._y/225)*region_txt.maxscroll;
}
}
Cutting Short A For Loop ...
Here is my code:
Code:
for (var k = 2; k<feedArray.length; k++) {
trace(feedArray.length);
display.htmlText += "I am a line of text";
}
So my problem is that sometimes the feedArray.length is huge, over 250, and this creates other problems in my code. What I want to do to combat this problem is to only run this for loop on the first 40 items of any given feedArray.length (which varies greatly and over which I have no control).
So can anyone suggest a solution - perhaps using while and do (or something else maybe ???);
Thanks for any help,
Stephen.
Making A Short Quiz
I am trying to make a short quiz with four questions, depending on which button they click on they get a total score, each question is either given 100 or 0, then i want a total score of x/100 to output. I can't seem to change the variables with buttons, here is the script:
-------------------------
q1 = 0;
q2 = 0;
q3 = 0;
q4 = 0;
stop();
b1_1.onPress = function() {
q1 = 100;
};
b1_2.onPress = function() {
q1 = 0;
};
b2_1.onPress = function() {
q2 = 100;
};
b2_3.onPress = function() {
q2 = 0;
};
b3_1.onPress = function() {
q3 = 100;
};
b3_2.onPress = function() {
q3 = 0;
};
b4_1.onPress = function() {
q4 = 100;
};
b4_2.onPress = function() {
q1 = 0;
};
totalscore = (q1+q2+q3+q4);
answerbtn.onPress = function() {
trace(totalscore+"/400");
};
------------------------
I know the answer is easy, thanks in advance-
kidix
Imported Videos Short
Hey,
I had some RealMedia videos that I wanted to use in a flash file, so I converted them to mpg format and imported into flash. Now my problem is, when each file plays say in Windows Media Player, the track bar shows a shortened duration than the original, but when played it will play the whole movie (it gets to the end and continues playing, even though the track has elapsed).
The issue with Flash is that when I import, the clip is automatically shortened to that length I get in Windows Media player, when there still is more movie left in the file. Any suggestions?
Short Animation Gets Out Of Sync
I'm looking for someone who would seriously like to help me. I created a simple animation with all imported wavs that I set to stream. Halfway through this animation (where the foot smashes the bread), the audio stops going with the animation. I've tried so many things. I'd really appreciate if someone would download my .fla file: http://home.comcast.net/~a.aragon10/bread.fla (its over 5mb) and tell me what I'm doing wrong, if anything. You'd make my day. Seriously.
[CS3] Variable String Being Cut Short
I've got an ASP file that is passing a variable from a database into my flash project and displays it in a text box.
This works fine until the is an apostrophe in the string. If there is one the string gets cut short. For example:
"here's my example string"
would become
"here"
I've also tried passing it like this "here's my example string" but that still doesn't seem to work.
Any ideas?
Thanks
Buying A Short Job - 10$ Paypal
Hello,
I look for good programmer in Flash CS 3 who knows to use functions(e.g. exporting for get method more...)
my msn is: mr.project.web@gmail.com
i am willing to pay 10$ for the job.
thanks for your help
din
Short Pause Within A Function?
I have a function that looks like this:
Code:
// define the "funcQuizScore" function;
function funcQuizScore() {
loadMovie(sMediaPath+"quizscore.swf", mcQuizScore);//load QuizScore movie;
nQuizScore=(nQuizScore/4*100);//calculate score percentage;
if (nQuizScore >= 75) {
mcQuizScore.gotoAndStop("pass");//play QuizScore PASS;
} else {
mcQuizScore.gotoAndStop("fail");//play QuizScore FAIL;
}
}
I think need a slight delay between the loadMovie statement and the if/else statement in order to load the movie and have it ready when the if/else statement executes.
I have looked at setInterval but that always seems to be a separate function. Is there another way to do a brief pause or can I somehow call a setInterval function from inside the above function?
Thanks!
PS: I'm new at AS coding so no laughing at my clunky code.
What's Wrong With This (really Short) Code?
I have two (more to be added) buttons: When either is pressed, an mc appears (different mc for each button). If the first button is pressed when the second button's mc is visible, the second button's mc gets set to _visible=false (so the clips don't appear 'on top' of each other). And vice-versa.
Here's the code:
q1_btn.onPress = function() {
_root.q1_mc._visible = true;
_root.q1_mc.gotoAndPlay("start");
_root.q2_mc._visible = false;
};
q2_btn.onPress = function() {
_root.q2_mc._visible = true;
_root.q2_mc.gotoAndPlay("start");
_root.q1_mc._visible = false;
};
And this works! What happens, and what I cannot figure out, is:
If I press the first button (first mc appears), then the second button (first mc dissappears; second mc appears), then the first button again—I have to press it twice to get the mc visible.
All subsequent presses require two presses for the mc of each to appear.
I intend to have a number of buttons acting like this so the user can go back and forth, and in any order. I just cannot understand what is causing two presses to be needed!
I have looked at this code for so long I'm not even seeing it anymore! My head hurts...
Convert Short Code To AS3
Can someone convert this short code to AS3?
Code:
on(press){
dragging = true;
orig_mouse_angle = Math.atan2(_parent._ymouse-_y, _parent._xmouse-_x) * 180/Math.PI;
orig_rotation = _rotation;
orig_x = _parent._xmouse;
}
onClipEvent(mouseMove){
if(dragging){
curr_mouse_angle = Math.atan2(_parent._ymouse-_y, _parent._xmouse-_x) * 180/Math.PI;
_rotation = orig_rotation + curr_mouse_angle - orig_mouse_angle;
updateAfterEvent();
}
}
on(release,releaseOutside){
dragging = false;
}
Short Comment On Randomness...
Hi:
This isn't a question, but it's something I think it's worthy of say; I'm working with FlashMX, and had a few random() scripts in my code. But in the constant testing I noticed that everything was turning very sluggy in the movie, and even in the computer itself.
Consulting the dictionary, I saw that random() is deprecated since Flash 5, and that the use of math.random() is recommended instead.
I had to look here and there before learning how to use the .math object correctly, but it's worth the shot. A lot of performance issues with my movie were gone, and I'm a very flash user now and blah blah blah...
Here at actionscript.org is a nice tutorial about this subject, go to
http://www.actionscripts.org/tutoria...ns/index.shtml
Greetings to all
Sir Patroclo
|