Trace Statement Not Working
OK I have no idea whats going on, I can't get anything to work properly right now. I'm kinda new to this so If i'm missing something obvious please forgive me.
In an effort to simplify things I wrote the most basic script I could and it is NOT working,,, by that I mean I'm not getting the "trace statement" I'm not getting any errors either...
Here is the code I have PLEASE HELP !
(I have an FLA File named "landingPage" and an AS file named "main" the AS is in a sub folder named 'src' and the document class for "landingPage" is "src.main". All I want here is a simple trace statement to make sure I am starting on the right foot.....)
ActionScript Code: package src{ import flash.display.MovieClip; public class main extends MovieClip { public function Main() { trace("working"); } }}
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 01-15-2009, 09:35 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Trace Statement Not Working In Document Class
Hi,
I am new to actionscript and just like some of you, I would like to start off on the right foot. After several attempts to solve this problem I am now taking a break and reaching out to those in the community. I have created a .as file named Main.as and the code inside main.as is:
package
{
import flash.display.MovieClip;
public class Main extends MovieClip{
public function Main()
{
trace("This code works..");
}
}
}
then i created a new fla file and named it testas. I then typed Main in the Document class under properties.
The code has no errors and when I attempt to test the movie, there is no output to the output panel..
Can anyone please help or explain to me why this is happening??? Thank you...
Simple Trace Statement
I can't for the life of me come up with a trace statement that tells me which "children" are on the stage at run time.
I use this to tell me how many are on the stage:
ActionScript Code:
trace(this.numChildren);
It seems I am missing an addChild call, and I want to figure out which children are on the stage. Thus eliminating areas that could be causing my problem
Simple enough I'm sure.
Thanks!
Lance
Trace Not Working... ?
I am trying to use the Trace() feature in Flash MX 2004 Pro but its not working for me.
This is what I am doing...
• Create new project
• File > Publish Settings > Omit Trace Actions
• Added this to first frame: Trace("It Works!");
• Opened Output Window
• Published in Flash
Shouldnt this print "It Works!" in the output window? Its not...
Thanks
Trace Not Working?
I'm updating some old code (actionscript 1) to flash 8 and trying to run traces to find how everything links. but trace won't run. any ideas of what could be wrong. theres not a way to turn trace off is there? i can't even get trace to work from frame 1
Trace Not Working ?
For some strange reason Flash stopped returning trace results (Actionscript 2.0)
Any idea what could cause this? The movie doesn't look like it stopped. Is there anything that would conflict with a trace? And actually will I'm asking about traces...is there a way to make the results of a trace into a new variable? As in PHP were you can echo the result of a query or use something like:
while(list($varible) = mysql_fetch_row($result)){
$this = "$varible";
Is there an actionscript method like this?
AIR Trace Not Working In Air/cs3
Hi,
This may be something obvious but after installing adobe air, trace no longer works to my output window.
I've checked the publish settings and 'omit traces' is unchecked.
Anybody else have any ideas?
Trace Not Working
Hey all.. I'm trying to do some quick debugging, and I'm not able to get the trace() function to work. I'm using flash 9 on a mac with AS 2.
The rest of my actionscript seems to work except I'm also having a problem testing my mouse position.. when I create new files everything works fine... any thoughts?
Trace Action Not Working
Is there any basic reason why Trace would not work anymore?
I ususally use Trace a lot in my coding to see what's happening, but I can't get it to come up at all anymore. Could there be something turned off that's not allowing it to show results?
Trace( ) Command Not Working?
I've got no idea how I screwed it up.
The "omit trace actions" is not checked.
I deleted the pref files like like someone said on a previous post.
Even a simple trace(hello) in a otherwise entirely blank document wont work.
What the heck is my problem? Thanks.
Trace() Action Not Working?
Allright, I posted a week or so ago and couldn't get it working then either. Since then I've replaced my hard drive and operating system and upgraded to MX 2004. The d@mn thing still dont work.
The "omit trace actions" is not checked.
Even a simple trace("hello"); in a otherwise entirely blank document wont work. I've attached a test file.
What the heck is my problem? Thanks.
Trace Function Not Working
everytime i use a trace fucntion, i areas I know work, as I have tested via other means, the trace fails to show in the output window!
anyone else ever have this problem?
Trace Function Not Working
I am trying some very simple code and I can't get it to work. To debug, I tried using the trace function and that doesn't even work! I opened a new doc, I added it to an old doc, but nothing seems to work!
Code sample
var myNum:Number;
pic_btn.onRelease = function () {
gotoAndPlay(2);
myNum = 0;
trace(myNum);
}
contact_btn.onRelease = function () {
gotoAndPlay(2);
myNum = 1;
trace(myNum);
}
The gotoAndPlay works but the variable doesn't get set and the trace function does not fire. What am I missing. Please help if you can!
Thanks,
Roachmoe
[F8] [AS2] Trace Function Not Working
Guys, here's the hell thing:
I have two flas, with two different movieClips that extends differents Classes.
The first .fla loads the second: just like Default.fla load catalog.fla
all the functions are working just Ok, but... on the movieclip at catalog.fla, the class dont show ANY trace, eventhough it runs into all the functions.
I have even created a dinamic textfield and in the constructor function of the class I set some text and it did it, just well... what proves my functions are all working, but from any hellish reason I cant see ANY trace, so I just am not able to debug this damn class.
Could someone help me? please.
trying to be a little more expecific:
I have default.fla who has a movieClip called main. Main is a Class who extends Controller class.
And I have catalog.fla who has a movieClip called photos. Photos is a Class who extends Remote class.
so photos runs inside main. all the actions are ok, but It just stop showing me the traces of ONLY the Photos Class!
My Trace Function Not Working
hi i am trying to trace "newcolor" but its not working
_root.clr10.onRelease = function () {
newcolor = "w10"
}
function objDrop2()
{
var _loc3 = this.newgrid1.attachMovie(newcolor, "obj" + String(objCountx), objCountx);
trace(this.newgrid1[newcolor]._name);
}
Trace Is Not Working Anymore
stange, i'm using the trace function, it was working in the begining of my project, and now, nothing to show , is there a limit in the trace actions ? or something like that ? if i'm creating a new project, the trace function is working perfectly..
Trace Command Is Not Working
Hi,
I've a flash movie for an interactive map. There are around 400 lines of code for that. The code is written by some other person. But now I've to change the corordinates of a moving object. So I tried to trace the current value by using trace (); It doesn't show anything. Even if it's an undefined value it should display in the output pannel. I just wonder why this command is not working.
I'm sure that there is a value is being passed on this. Any help will really appreciable.
Trace Is Not Working Anymore
stange, i'm using the trace function, it was working in the begining of my project, and now, nothing to show , is there a limit in the trace actions ? or something like that ? if i'm creating a new project, the trace function is working perfectly..
Trace Command Is Not Working?
hey all I am trying to place a name into a varible on a press command but for some odd reason its not doing it? go any ideas
on (press) {
_root.marker_mc._x = -1277;
_root.running = true;
_root.section = brave;
trace("_root.section");
trace(_root.section);
}
where ever that button is pressed the trace says the varible in undefined. I have the first as an expression so I can track what varible I am tracing. thanks US.
x4design
The heart never speaks but you must listen to it to know it.
Trace() Command Stopped Working
I have noticed every so often the trace() command doesn't work with certain .fla files. Now I have a project where the trace() command was working, but now it does not work. I am talking about work at all. I probably have 100 times that I use trace() in my .fla Any suggestions?
Trace Not Working In Package Class
Hi All
I am new to as3 and wrote my first package/class. It all works great but I am trying to expand the functionality but need the trace to work in the class so I can see if things are happening. However it never trace anything. I know the class works as it draws the square but cant figure out why trace would not work. the class is used via import and not document class.
Dyncamic Text Not Working - Can Trace Value
Hi,
The following code works fine except for the damn dynamic text component. The trace(encrypted); outputs correctly, so the value is there (it's 17 btw), but encrypted.text = encrypted; does nothing to a dynamic text field on the stage with that instance name. All elements on are sitting in one frame at the root so I can't imaging that there are targeting issues. What could it be?
Code:
submit_btn.onPress = function()
{
var send:LoadVars = new LoadVars;
var receive:LoadVars = new LoadVars;
send.toPHP = input.text;
receive.onLoad = function()
{
encrypted = this.toFlash;
trace(encrypted);
encrypted.text = encrypted;
}
send.sendAndLoad("mypath.php",receive,"POST");
//end of submit brackets
};
Trace And Interval Not Working In Prototype Code Of Loaded Movie
I've got a movie that is pausing and then fading-out when the movie ends. This is being done (thanks to the excellent advice from clbeech) by
1) modifying the MovieClips prototype and adding a fade() method
2) calling that method in the last frame (after saying "stop" of course)
It's all working splendidly.
Now, I'm using the MovieClipLoader class to load that standalone movie into a "loader movie". Basically the loader loads a bunch of movies sequentially and relies on the fade-out embedded within the loaded movie to make a nice transition to the next one in line.
The problem I'm having is two-fold:
1) The pause-before-fade-out method works great when the movie is played within the "loader" but fails when the movie is loaded into another via the MovieClipLoader. The fade works but the pause (the interval) seems to be ignored.
2) Trace statements in the fade prototype function work fine in standalone mode, they cease working when the movie is loaded into another via the MovieClipLoader. The function is definitely getting called (the fade begins) but I don't see the trace statements. Trace statements in the other "normal" frame code of the loaded movie appear fine, just not the trace statements in the custom prototype function.
Code is attached...
NOTE: the loader movie isn't actually fully working yet, that part is code-in-progress. But it works well enough to demonstrate the problems above. I still have to figure out how to signal the next movie to start as the fade-out of the last one begins (I'm thinking I'll define a global and call that in the loaded movie when it initiates its fade out). I certainly wouldn't mind advice/guidance on the loader-portion of things, too, particularly if what I'm doing seem really wonky.
Thanks!
- Gary
P.S. Using AS2 and Flash 8 publish settings.
[FMX] If Statement Not Working
Hi,
I am making a music player on my site..
it contains:
play button
next button
prev button.
in the play button, i've assigned the following code:
**********************
on (release) {
stopAllSounds();
Song1.start();
Playing1 = true;
Playing2 = false;
Playing3 = false;
current_song = title1;
}
**********************
in the next button the following code:
**********************
on (release) {
if (Playing1=true) {
stopAllSounds();
Song2.start();
Playing1 = false;
Playing2 = true;
Playing3 = false;
current_song = title2;
} else if (Playing2=true) {
stopAllSounds();
Song3.start();
Playing1 = false;
Playing2 = false;
Playing3 = true;
current_song = title3;
} else if (Playing3=true) {
stopAllSounds();
Song1.start();
Playing1 = true;
Playing2 = false;
Playing3 = false;
current_song = title1;
}
}
**********************
It only works half...
If i push the next button, it starts the second song...
but when I push it again... it starts the second song again...
It doesn't play the 3d song...
Can somebody help me?
If Statement Not Working ;(
createEmptyMovieClip("h_user",1);
createEmptyMovieClip("h_upgrade",2);
_root.h_upgrade.loadVariables("userplan.php"); userplan = _root.userplan;
h_user.loadMovie("user.swf");
if (userplan < 4) {
h_upgrade.loadMovie("upgrade.swf");
}
this is on the first frame+layer of my movie, it loads both movies fine, but ignores my if statement. userplan.php outputs a variable for it, so im at a loss for what the problem is.
If Statement Not Working
Hi All
Can someone take a look at this if statement and see what Im doing wrong.
if((ageCombo.getValue() == horse1.age || ageCombo.getValue() == horse1.nb) and (colorCombo.getValue() == horse1.colour || colorCombo.getValue() == horse1.nb) and oddsCombo.getValue() == horse1.odds and lastRanCombo.getValue() == horse1.placed){
horseToDisplay.push(horse1.name);
}
Basically what Im trying to say is the age combo box will either return a value or nb, the same with the colour.
Im not getting any errors in the script but its still not working.
Thanks
If Else Statement Not Working
I've been trying to get these 'If else' statements to work properly and sometimes they work and sometimes they don't.
I have six buttons that when released call a variable.
button one calls this variable :
on (release) {
section = "section01";
checkSection();
} . . . and so forth for all the buttons.
Then I have this code on a frame :
function checkSection() {
if (section == "section02") {
_root.fader02.play();
} else if (section == "section03") {
_root.fader03.play();
} else if (section == "section01") {
_root.fader01.play();
} else if (section == "section04") {
_root.fader04.play();
} else if (section == "section05") {
_root.fader05.play();
} else if (section == "section06") {
_root.fader06.play();
}
}
But it seems as though the function is not working, I've tried it many ways. With quotes and without, even using the variable in an absolute path and nothing still. I herd that on maybe it's only getting called once and I don't fully understand this - amybe this is my problem - - Can anyone offer any
insight here ??
Thanks.
If Else Statement Not Working?
Hello, I have a movie clip that is giving me some trouble. Inside my movie clip I declare a boolean variable to = false on the first frame of the movie clip. On the last frame of my movie clip I set the variable to = true. On the last frame there is also a button that goes to frame 33 on my movie clip and plays. Around frame 50 or so I have an if else statement I "believe" says that if the variable = true go to the last frame and stop, else if the variable = false to keep playing the movie clip.
Anyways, I can't seem to figure out what the deal is. I've been messin with it for way to long. Any idea's or suggestions would be greatly appreciated. Here's the link to the .fla file...
http://www.boomspeed.com/danarchy/401k.fla
, Stea|th
If Statement Not Working
I have a button with this code on it...
on (release) {
if (_root.title.titleOn=false) {
}
if (_root.title.titleOn=true) {
_root.title.gotoAndPlay("titleOut");
}
}
This should tell the movie clip "title" that if it's on, turn it off by jumping to "titleOut" in my timeline. At the beginning of the timeline and at the stop of the animation, I set the variable "titleOn" to true(_root.title.titleOn=true.
At the end of the timeline where the animation stops and disappears, I set the variable "titleOn" to false(_root.title.titleOn=false.
The button turns my animation off, but when clicked again, it replays the "off" animation. What have I done wrong here? Thanks
If Statement Not Working?
Hi folks.
I've got a movie clip called 'soundToggle'. It's default position points to 9 (imagine a clock face). On click, it rotates via 12 and points to 3. Here comes the problem. When I click it again, I want it to rotate back to 9 (via 12) but it doesn't.
The first part works fine, but when you click it a second time it does nothing. I've traced the statement and I'm not sure why. Here's the code I use on a frame:
_root.soundToggle.rot = 0;
_root.soundToggle.music=true
_root.soundToggle.onPress = function() {
this.onEnterFrame = function() {
if (this.music)
{
if (this.rot < 180)
{
this.rot= this.rot+4;
this._rotation = this.rot;
}
this.music=false
}
else if (this.rot > 0)
{
this.rot= this.rot-4;
this._rotation = this.rot;
}
this.music = true
}
}
Any help would be much appreciated.
If Statement Not Working
Hi,
I have a problem with my if statements. I have a word and picture displayed on the screen. If the word and picture match the user presses the left arrow key for yes. This adds 1 point to the score. If the word and picture do not match then they press the right arrow key for no. This also adds 1 point to the score cos its the right answer. However the problem I have is if the user presses yes when the picture and word do not match. This should then minus 1 from the score because its the wrong answer. And the same should happen if the word and picture match and they press no.
I have this code on a blank yes button on the stage.
if (varWord ==varPic) {
score++;
}else{
score--;
}
this code is on the no button
if (varWord !=varPic) {
score++;
}else{
}
score--;
}
As the moment its subtracts the score if the word and picture match and you press yes. I think its matching whether the word and picture match rather than actually whether the key press is correct.
Ive attached my fla. Can anyone see where this is going wrong?
Thank you
If Statement Not Working
i have a button that is supposed to make a contact panel appear when you press it and make the panel close when clicked again. i'm trying to do it using if statements but it's not working. in the file the button i'm tlaking about is the circle to the right (3rd out of 3)
If/Then Statement Not Working
Hi, I'm new here, and I'm sure this question has been asked before, but here it is again anyways.
I'm pretty new to Actionscript, and I'm trying to create an application similar to the card game "war", wherein the computer generates two random numbers, evaluates which number is higher, and then displays text dependent on the outcome. I have the random numbers part working fine, but everything else is kind of screwed up. Here's the code I have attached to the "Deal cards" button:
Code:
on(click) {
with(_parent){
card1_txt.text = Number (random(12));
card2_txt.text = Number (random(12));
}
if(card1_txt < card2_txt){
winlose_txt.text = String("Loser!");
}
}
Using this code, both numbers are generated, but the dynamic text box I have set to display the value of winlose_txt never displays anything, so I think its a problem with the if/then statement. Can anyone help a n00b out?
Thanks!
For Statement Not Quite Working
code:
function flasher () {
trace ("flasher running");
count = 20;
for (i = 0; i < count; i++) {
flashs = (i % 5) ? "0" : "1";
trace ("flasher=" + flashs);
win11._visible = flashs;
}
}
If i am right this should make win11 flicker 4 times but it aint
I dont need to use a onEnterFrame for this do i?
For Statement Not Working
hi there
i am having trouble loading thumbnails into containers using the for statement.
there are 30 containers and want to use a for statement instead of typing out 30 lines of loadMovie. I have tried to use this but it doesnt work.
Code:
for(i=1; i<31; i++)
{
this['thumbHold'+i].loadMovie('images/thumb'+i+'.jpg');
}
the image being thumb1.jpg........thumb2.jpg .......so on
Please please help ....
If Statement Is NOT WORKING
Hi,
Last post now hopefully today!
I have worked round my last two problems with a bit of help but now i want the check button to check to see if the child who has inputted the answer has got the question right.
If the answer is right it should be as folllows
if num5 = num1 + num2 play mysoundsgood(10)
or if it's not play mysounds(10)
I have tried numerous combinations but still not getting it to work!
Any ideas everyone?
Also how do I get the cursor to flash in num5 when you click the 'Get Calculation' button?
Cheers
Chris
If Statement Is Still Not Working Help Please
Hi,
Last post now hopefully today!
I have worked round my last two problems with a bit of help but now i want the check button to check to see if the child who has inputted the answer has got the question right.
If the answer is right it should be as folllows
if num5 = num1 + num2 play mysoundsgood(10)
or if it's not play mysounds(10)
I have tried numerous combinations but still not getting it to work!
Any ideas everyone?
Also how do I get the cursor to flash in num5 when you click the 'Get Calculation' button?
Cheers
Chris
If Statement Not Working..
I do not seem to be able to make my IF statment work!?!
First frame I setup a varable:
Code:
var stat=0; var user=""; var pass="";
I pop up an input box for user name and password. Having collected the data I send it to a php page and wait for a reply
Code:
login.onRelease = function (){
send.user = user
send.pass = pass
send.sendAndLoad("http://127.0.0.1/chat/login.php", receive, "POST");
}
receive.onLoad = function()
{
trace (this.ready);
trace (this.stat);
gotoAndStop(3);
}
This part works and returns the values I would expect..
At the next frame I have this code..
Code:
if (stat = 1)
{
gotoAndPlay(4);
status = "OnLine";
trace("Set Online");
}
else
{
gotoAndPlay(1);
}
This should goto fram 4 if the login went ok and goback to frame 1 if the returned status is not 1..
Why is this not working? I even tried if (stat = "1") still will not work.. It always goes to frame 4
[F8] If Statement - Why Is This Not Working?
Hello,
I thought I understood the "if" statement but it seems i don't.
Could someone tell me why this doesn't work.
I have attached a test .fla file.
I have a movie clip on the stage.
When you click it it moves across the stage.
When it gets there I no longer want it to be clickable (or have any of the previous AS associated with it.
So, I put the button functions in an "if" statement and used a Boolean variable to say 'only do this stuff if the var == true.
PHP Code:
stop();
var buttonWorks:Boolean = true;
if(buttonWorks == true){
circleMc.onPress = function(){
gotoAndPlay(20);
circleMc.gotoAndStop(1);
}
circleMc.onRollOver = function(){
circleMc.gotoAndStop("over");
}
circleMc.onRollOut = function(){
circleMc.gotoAndStop(1);
}
}
Then on the frame where the circleMc moves to i change the var to false.
This just doesn't work!!
Could someone explain why, or what I've done wrong.
I'm trying to learn this AS stuff!
[F8] Why Is This IF Statement Not Working?
I've got a button which is sending commands to _parent.one MC. If works up to the first "else if" but after that it won't follow through with the command even though the trace is showing that that _parent.two is equaling 10. Why does this simply not work?
Code:
adam.onRelease = function() {
trace(_parent.two._currentframe);
if (_parent.one._currentframe == 1) {
_parent.one.gotoAndStop(10);
} else if (_parent.one._currentframe == 10) {
_parent.two.gotoAndStop(10);
} else if (_parent.two._currentframe == 10) {
_parent.two.gotoAndStop(30);
}
};
Cheers!
[F8] If Statement Not Working
I am using the LoadVars object and from that I am using the sendandload method. The data sends to the Java Servlet I am using and in turn the servlet returns a result. The problem is that the if statement i am using does not seem work. I should of mentioned the program is a simple username and password checker.
Code:
on (release) {
myVars = new LoadVars();
myVars.login = "true";
myVars.name1 = _root.nameText.text;
myVars.password1 = _root.passwordText.text;
myVars.sendAndLoad("http://localhost:8080/djs/Test", myVars, "post");
myVars.onLoad = function (success:Boolean) {
if (success) {
_root.lblLogin.text = "TempLogin is " + myVars.login;
if (this.login == "1") {
_root.lblLogin.text = "TempLogin is " + myVars.login;
}
}
}
}
Can anyone please help?
The If() Statement Is Not Working
hi guys.. check this out.. in my database, i have a field called CategoryType and its type is: char.
In flash mx, i grab the data of CategoryType (XML file type) and i got MF.
CategoryType = myData.firstChild.firstChild.childNodes;
when i put this:
if(CategoryType == "MF"){
trace("hello")
}
but its not working! Any idea?
If Statement Not Working
Please Help Me
i have made a if & else if code in it but it dosen't check the conditional & executes the code in the if bit.
Here is the code::
function PTurn() {
if (playerturn == 1) {
var colorful = new Color(_root.instName);
colorful.setRGB(0x0000FF);
btn_enabled = false;
} else if (playerturn == 2) {
var colorful = new Color(_root.instName);
colorful.setRGB(0xFF0000);
btn_enabled = false;
}
}
If Statement Not Working.
This statement isn't working
if (mc1=true){mc2=mc2+20}
It's on the main timeline, and as soon as it hits that frame with the code, it makes mc1 true, and performs mc2=mc2+20, even though before that mc1=false. Whats wrong??
For Statement Not Quite Working
ActionScript Code:
function flasher () {
trace ("flasher running");
count = 20;
for (i = 0; i < count; i++) {
flashs = (i % 5) ? "0" : "1";
trace ("flasher=" + flashs);
win11._visible = flashs;
}
}
If i am right this should make win11 flicker 4 times but it aint
I dont need to use a onEnterFrame for this do i?
If Statement Not Working
Hi--
I've searched around and can't seem to understand why this wouldn't work:
ActionScript Code:
function tweenTxt(){
textBG_mc.tween("_height", 427.9, 1.5, "easeInOutCirc");
if(textBG_mc._height == 427.9){
trace("that actually worked!");
}
}
I've tried setting a variable = textBG_mc, and Math.round, maybe I'm not getting the context right, I've tried this.textBG_mc.etc, hmmm. The if is not returning true, is that something with the tween?
Any help would be appreciated.
Thanks
If Statement = Working
I’m loading Flash vars from my page using a Javascript shown here:
quote:<script type="text/javascript">
var1 = "foo";
var2 = "";
</script>
I'll make this short. The vars do get into my Flash movie and all works fine when the vars have values. But I need to check if the vars have values and if not skip a function.
Here is the if statement I’m having trouble with:
quote:
if (var2=!undefined) {
attachMovie("MC", "MC", 1);
}
If var2 has no value, the MovieClip "MC" still gets shown.. I've tried adding var2=null; in the JavaScript but the MovieClip is still shown. I know "if var2 not undefined" is probably a strange way to check a value. I've tried "if var2 undefined - return;} else { attach MovieClip" and that doesn't recognize the empty value either :(
Any help is greatly appreciated!
'IF' Statement Not Working Right
I have a chat window much like MSN Messenger I made in flash, and I am trying to get it to be able to carry on a conversation with the user... Keep in mind that this script is attached to a button, user field is where the user types, and reply is where they see their reply.
this chat is suposed to be able to keep a small conversation with a child, and I use 1 and 2 letter variables to help control the bot to tell it where it should be in the conversation. If you read over the source, it should give you some idea on where I am trying to go with it...
The problem it, the variable Q is not progressing to 1, it is staying on 0.
Here is the source...
Attach Code
on (release, keyPress "<Enter>") {
_root.reply.htmltext = _root.reply.htmltext+"<b>"+kname.text+": </b>"+_root.user.text;
_root.user.saveText = _root.user.text.toLowerCase();
function respond() {
/*************************************************************************************************/
/*
Q = main question database
x = Has santa asked user what they would like for christmas
1 = Yes
0 = no
xa = Has the previous question been answered?
1 = Yes
0 = no
z = Has Santa asks for users fav reindeer
1 = Yes
0 = no
za = Has the previous question been answered?
1 = Yes
0 = no
gb = Has Santa asked is user was good
1 = Yes
0 = no
gba = Has the previous question been answered?
1 = Yes
0 = no
*/
trace("Q is "+Q);
if (Q == 0) {
if (bg = 0){
//_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Have you been good this year?";
_root.status.text = "";
gb == 1;
}
else
if (_root.user.saveText.indexOf("yes") != -1 || _root.user.saveText.indexOf("yeah") != -1 || _root.user.saveText.indexOf("yup") != -1 || _root.user.saveText.indexOf("yea") != -1 || _root.user.saveText.indexOf("sure") != -1 || _root.user.saveText.indexOf("yah") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Great, that’s what my list tells me! Let’s make up your Christmas list! :)";
_root.status.text = "";
Q = 1;
gba == 1;
gotoAndPlay(11);
} else
if (_root.user.saveText.indexOf("no") != -1 || _root.user.saveText.indexOf("nah") != -1 || _root.user.saveText.indexOf("not") != -1 || _root.user.saveText.indexOf("nope") != -1 || _root.user.saveText.indexOf("na") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I'm sorry to hear that but, according to my list, I think you have been very nice this year and I would still like to give you something special. Lets make a Christmas list! :)";
_root.status.text = "";
Q = 1;
gba == 1;
gotoAndPlay(11);
} else
trace("Q currently equals "+Q);
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Im sorry, I did'nt understand what you said, have you been good this year?";
Q = 0;
gb == 1;
gba == 0;
gotoAndPlay(11);
}
else
if (Q == 1) {
if (x=0){
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What would you like for Christmas this year?";
_root.status.text = "";
x=1;
}
var randNum=Math.round(Math.random()*10)
if (randNum==0) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Got it! What else would you like?";
_root.status.text = ""; }
if (randNum==1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> That is popular this year, what else would you like?";
_root.status.text = ""; }
if (randNum==2) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Wonderful, what else would you like?";
_root.status.text = ""; }
if (randNum==3) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Jotted on my list, what else would you like?";
_root.status.text = ""; }
if (randNum==4) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Very nice, what else would you like?";
_root.status.text = ""; }
if (randNum==5) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Great, what else would you like?";
_root.status.text = ""; }
if (randNum==6) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> That is a popular request this year! What else would you like?";
_root.status.text = ""; }
if (randNum==7) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Good choice! What else would you like?";
_root.status.text = ""; }
if (randNum==8) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Very nice, what else would you like?";
_root.status.text = ""; }
if (randNum==9) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Wonderful idea, what else would you like?";
_root.status.text = ""; }
// Q 1 EXIT CODE START
if (_root.user.saveText.indexOf("quit") != -1 || _root.user.saveText.indexOf("exit") != -1 || _root.user.saveText.indexOf("imdone") != -1 || _root.user.saveText.indexOf("nomore") != -1 || _root.user.saveText.indexOf("nothing") != -1 || _root.user.saveText.indexOf("done") != -1 || _root.user.saveText.indexOf("finished") != -1 || _root.user.saveText.indexOf("complete") != -1 || _root.user.saveText.indexOf("all") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> •We have quite a list! Before I close my book, is there anything else you would like me to add?";
y=1;
}
if ( y = 1 && _root.user.saveText.indexOf("no") != -1 || _root.user.saveText.indexOf("nah") != -1 || _root.user.saveText.indexOf("not") != -1 || _root.user.saveText.indexOf("nope") != -1 || _root.user.saveText.indexOf("na") != -1 || _root.user.saveText.indexOf("done") != -1 || _root.user.saveText.indexOf("finished") != -1 || _root.user.saveText.indexOf("complete") != -1 || _root.user.saveText.indexOf("all") != -1) {
_root.status.text = "";
Q = 3;
X = 1;
gotoAndPlay(11);
}
else if ( y = 1 && _root.user.saveText.indexOf("yes") != -1 || _root.user.saveText.indexOf("yeah") != -1 || _root.user.saveText.indexOf("yup") != -1 || _root.user.saveText.indexOf("yea") != -1 || _root.user.saveText.indexOf("sure") != -1 || _root.user.saveText.indexOf("yah") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What would you like for Christmas this year?";
Q = 1;
x = 1;
}
// Q 1 EXIT CODE START
}else
if (Q == 3) {
if ( z = 0 ) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Tell me who your favorite reindeer is and I will tell you a little about them.";
z = 1;
} else if ( z = 1 ) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> What other reindeer would you like to know about?.";
z = 1;
}
if (_root.user.saveText.indexOf("Dasher") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Dasher was the first reindeer and the right-hand leader of the sleigh before Rudolph was included? He is the speediest reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Dancer") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Dasher was the second reindeer and the left leader before Rudolph was included? She is the graceful reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Prancer") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Prancer was the third reindeer and on the right in the second row. He is the most powerful reindeer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Vixen") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Vixen was the fourth reindeer and on the left-hand side in the second row? She is beautiful and also powerful like her companion Prancer.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Comet") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Comet was the fifth reindeer and on the right-hand side in the third row. He brings wonder and happiness to children when we fly over everyone's houses.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Cupid") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Cupid was the sixth reindeer and on the left-hand side in the third row. She brings love and joy to children when we fly over everyone's houses.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Donner") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Donner was the seventh reindeer and on the right-hand side in the fourth row. His original name was Dunder, a variant of donder, meaning 'thunder' in Dutch.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Blitzen") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Blitzen was the eighth reindeer and on the left-hand side in the fourth row. Though female, she is frequently thought to be male. Her original name is Blixem. She is known as the lightning reindeer because the word 'Blitz' is German for lightning, as is 'Bliksem', her original name, in Dutch.";
_root.status.text = ""; }else
if (_root.user.saveText.indexOf("Rudolph") != -1)
{
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Did you know Rudolph was the son of Donner, and was born with a glowing red nose, which made him an outcast among the other reindeer? I remember one Christmas eve it was too foggy for me to make my flight around the world. I suddenly noticed Rudolph's nose, and decided it could be a guide for my sleigh. Since then Rudolph has been a permanent member of my team, and leads us on our way.";
_root.status.text = ""; }else
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I don't remember that reindeer. My reindeer are Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blitzen and Rudolph. ";
}else {
trace(" SCRIPT PROBLEM, Q IS OUT OF RANGE. Q CURRENTLY IS "+Q);
trace(" CLOSE PROGRAM!");
}
/* Repository Stuff
if (_root.user.saveText.indexOf("hi") != -1 || _root.user.saveText.indexOf("hello") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Hi! How are ya?";
_root.status.text = "";
} else if (_root.user.saveText.indexOf("bye") != -1 || _root.user.saveText.indexOf("later") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b>Good chatting with you!";
_root.status.text = "";
} else {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I do not understand";
_root.status.text = "";
}
*/
/*************************************************************************************************/
clearInterval(myTimer);
}
var i = 5000;
_root.status.text = "Santa Claus is typing...";
myTimer = setInterval(respond, i);
gotoAndPlay(11);
_root.reply.scroll = _root.reply.scroll*2;
}
/* ORIGINAL SCRIPT:
if (_root.user.saveText.indexOf("hi") != -1 || _root.user.saveText.indexOf("hello") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> Hi! How are ya?";
_root.status.text = "";
} else if (_root.user.saveText.indexOf("bye") != -1 || _root.user.saveText.indexOf("later") != -1) {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b>Good chatting with you!";
_root.status.text = "";
} else {
_root.reply.htmltext = _root.reply.htmltext+"<b>Santa Claus: </b> I do not understand";
_root.status.text = "";
}
*/
If Statement Not Working
Can anyone tell me why this is not working
The if works but when I add the script to change the leading which on its own works
The leading will only use the first statement even when it should not.
The if is still working for the text frame move but the leading part does not abide by the if..
What am I doing wrong
Any help would be great
var lineHeight:Number = 50;
GuestsNames.autoSize = "center";
//GuestsNames.text = ("Mighael, Bjad, Kyle, Reneka and Ryan");
GuestsNames.text = ("Mighael, Bjad, Kyle");
var descFormat:TextFormat = new TextFormat();
if (GuestsNames._height>lineHeight) {
GuestsNames._y -= Math.floor((GuestsNames._height-lineHeight)/2);
descFormat.leading = -15;
} else {
descFormat.leading = 1;
}
GuestsNames.setTextFormat(descFormat);
If Statement Not Working
I'm new to actionscript...
For some reason my if statement is not working. It is in a movie clip of a blinking eye and I want the code to pause the blink for 4 seconds between blinks.
The movie clip does not have an instance name (which may be the problem).
Frames 1-12 is the eye blink animation. (no script)
Frame 13
Code:
timeDelay = 4+getTimer()/1000;
Frame 14 is empty
Frame 15 is
Code:
var timeYet = getTimer()/1000;
if (timeYet >= timeDelay) {
gotoAndPlay(1);
}
gotoAndPlay(14);
When I run the movie, the varaibles change like they should according to the time, but for some reason, it skips over the if statement even is timeYet is greater than timeDelay. I probably labeled the variables wrong, but I do how they should be.
|