ActionScript 1/2 :: F8as2 - Headscratcher! += Incrementation Stops For No Apparent Reason?
Jul 8, 2009
In trying to respond to a question I wrote a bit of code that just adds 0.01 to a number. It is displayed in a dynamic text field. If I start counting from 0 it only counts to 0.06. The counting stops but the onEnterFrame keeps running.
The Code:
var num:Number = 0;this.onEnterFrame = function() { num += .01; trace(num); num = Math.floor(num*100)/100; trace(" "+num);};
The Output:
0.01
0.01
0.02
0.02
[code].....
Why did the code stop incrementing after 0.07?
View 3 Replies
Similar Posts:
Sep 30, 2010
I have several two-sided ecards made with Papervision and TweenLite to flip them over.A couple of days ago the "flip" animation changed behaviour. This is in ecards I made several months ago. The ecards work OK but the PPV object is not positioned correctly.On the server, in IE the object is displaced to right and down by about 20 px. In FF it is displaced to up and left by about 10 px.In Chrome and Safari the display is OK.(Just to confuse you further, the display in FF is OK on my localhost).This effect seems to be local to my PC.
I have scanned for malware etc twice but nothing. I have the latest Flash player and browsers.
View 1 Replies
Mar 9, 2012
I am making a banner that has multiple movie clips sharing the same area, creating different rainbow effects when different areas (invisible buttons) are moused over.
First of all I couldn't figure out if there was a way to have one invisible button over the whole area that changed to a different colored effect with each mouse over (first mouse over the black and whites would change to reds, second would change it to blues, third would change it to browns, etc.). Since I couldn't figure this out I settled on creating three buttons covering a third of the banner each, so when the mouse passes over one button it changes to reds, over another button it changes to blues, over the third it changes to browns.
The effects are movie clips where each frame has another stripe changing color so it goes in a wave effect from one to the next, and then goes back to white and black in the same manner. The first frame of each movie clip I had to turn into a nested movie clip so I could turn the alpha to 0, since I was going to have these color effect movie clips on top of one another in the main timeline on different layers, and so you could see the effect even if that color layer wasn't on top. I used the same nested movie clip with zero alpha for the first frame of each color effect clip (reds movie clip, blues movie clip, etc), so I dont' know if that's an issue.
Anyway, it seemed to work fine for a while, but after working on it for a while longer (and not getting any further since I removed most of the changes I made), now when I test the movie the mouse over does not seem to work correctly. It works fine, seemingly, for the first time I mouse over each button, but in order to have it work again I have to mouse over the button twice, and then it will pause randomly during a part of the clip and I have to move my mouse back over for the movie clip to continue.
I can't tell if this is because of the overlapping movie clips, or because my buttons are messed up, or if my actionscript is messed up, or if the timeline has to be longer, or what. Currently the timeline is 55 frames, the same as each movie clip.
I put a movieclip_instance.stop(); command in the first frame of the main timeline, is there a better way to do this? Should I put the stop command in the movie clip itself?
Here is a section of my AS in the main timeline, this is my first time programming ever, in any language, and trying to learn from the internet is more difficult than I thought it would be.
redmovie.stop();
red_btn.addEventListener(MouseEvent.ROLL_OVER, playRed);
function playRed(event:MouseEvent):void
{
redmovie.play();
}
View 4 Replies
Jul 2, 2009
The Error Codes:
positionSelectedAirspeedBug.as: Line 20: ActionScript 2.0 class scripts may only define class or interface constructs. };
and
initializeAirspeed.as: Line 45: ActionScript 2.0 class scripts may only define class or interface constructs. };
Both lines refer to the last line of code which is a };
Background:I have an .fla that has only one line of code:
initializeAirspeed(currentAirspeed, buggedAirspeed);
This function is NOT in the .fla. This function does exists in an actionscript file 'initializeAirspeed.as' file which is in the same directory as the originial .fla.I had previously called this actionscript file with an #include statement. During debugging I removed the #include statement and all other code except the initializeAirspeed(currentAirspeed, buggedAirspeed); but the initializeAirspeed.as file is still called. I know because the initializeAirspeed.as file calls another asfile. My error statements include both the initializeAirspeed.as file and the other asfile.
I can comment out the 'initializeAirspeed(currentAirspeed, buggedAirspeed);' and all errors go away.I can create a new .fla with only the 'initializeAirspeed(currentAirspeed, buggedAirspeed); included and there are no errors. It appears the .fla has a memory for #include statements because if I use the #include statement then remove it I have problems..
View 3 Replies
Jan 27, 2011
I have a custom "StagedSprite" class that extends Sprite. Its purpose is to automatically align itself to the stage's border whenever the stage gets resized.NOW, I load a PNG file "ybmp" (Bitmap) and add it as child to "loadingIcon" (StagedSprite). In Flash CS5, the PNG is shown correctly on screen (aligned too). But if I publish and run the SWF from within Firefox or IE, the PNG IS NOT SHOWN!
What is even MORE strange is what the following code produces :
//var ybmp:Bitmap = the loaded bitmap
//loadingIcon is a StagedSprite
loadingIcon.addChild(ybmp);
trace(ybmp.bitmapData.width,ybmp.bitmapData.height);
trace(ybmp.width,ybmp.height);
trace(loadingIcon.width,loadingIcon.height,loadingIcon.getChildAt(0),loadingIcon.stage);
I put the "trace" results in a TextField on screen. In CS5, the code above produces :
215 200
215 200
215 200 [object Bitmap] [object Stage]
In Firefox and IE, the code above produces :
215 200
215 200
0 0 [object Bitmap] [object Stage]
What on earth is that?!? In the browsers, the Bitmap IS added in "loadingIcon" but "loadingIcon" still has its width and height set to zero. ?I could paste the StagedSprite code here too, but it's a little big and has no scrollRect property. After all, what could be the reason for it running in the Flash authoring tool but NOT in the browsers..?
View 1 Replies
Oct 16, 2011
I'm just installing Apparat, and I'm interested in using it to optimize my SWFs.
On its google code page some optimizations are listed out .. sliding window, flowgraph ... so is it possible to make use of these optimizations? how?
I have heard of the -reducer command, does it perform the optimizations? are there other commands you can use? or do you have to build apparat yourself and access it via scala?
View 0 Replies
Jul 20, 2005
I've been trying to figger this one out. How do you create a delay effect when dynamically attaching mc's to another mc, the stage, whatever.
say you're building an xml driven menu which is essentially a stack of mc's attached to another. how do you make them appear to fade in one by one, starting at the top and working toward the bottom? (i can create the effect, just not sure how to script it).
it's gotta be fairly straightforward since i see it lots of places. I tried creating it with frames but that doesn't work since the mc's get attached so quickly.
View 7 Replies
Aug 1, 2011
I should like to understand the cause different behaviour of the metod "drawPath" in this situations:
[code]...
If move comments on other metod ".drawPath(" two color will available.
View 3 Replies
Feb 28, 2012
For some reason my flash program closes on me. The strange thing is, it is only 2 MB. I have a good amount of shapehits in it as well. Would that cause it to crash?
View 1 Replies
Jul 10, 2009
I've got a function 'fullReset' which resets the stage and places several movieclips (which are balls) back to a starting area. Within this function is a call to the 'unlockBallfunction within the Ball class (see bottom of code below).
ActionScript Code:
private function fullReset(event:Event):void
trace("RESET BUTTON HIT");
[code].....
View 1 Replies
Sep 15, 2006
Code:
var remoteListArray:Array = new Array();
var listArray:Array = new Array('a0','b1','c2','d3','e4')
[code].....
View 2 Replies
May 4, 2008
I'll cut to the chase, here's my code:
Code:
function loadThumbs(){
for (var i = 1; i <= totalImages; i++){
[code].....
View 3 Replies
Jul 23, 2009
TypeError: Error #1010: A term is undefined and has no properties.
I get the above error when I run the below code:
[Code]...
View 1 Replies
Mar 7, 2012
I call the constructor from a fla file but i cant get a hold of the GamaDataArray via the getGameData() Function it keeps saying that the GameDataArray is Empty, but if i trace within the class it works, when i go to the fla file it says its empty. Can somebody please tell me what i am missing, i know its something super small
[Code]...
View 4 Replies
May 19, 2010
im having troubles unloading a swf file that is 2 levels above my main movie. Basically I have a main movie and I have actionscript on the timeline which corresponds to a button which loads a swf (eg my web portfolio work):
digitalbut.onRelease = function() {disableBtns();_root.createEmptyMovieClip("container",1);loadMovie("Digital/Digital_2.swf","container");container._x = -22 ;container._y = 40 ;
This all works....Then in this swf I have another button which again loads another swf on top to show a particular piece of work and the code on the timeline to correspond to the button is:
[Code]....
This works also....but I come into problems when I want to create a button in this third swf file which then closes this Dior.swf so you are left with the bottom two still showing. I already have a close button on the Digital.swf which works a charm to get you back to the main movie and the code for this is:
[Code]....
View 3 Replies
May 19, 2010
im having troubles unloading a swf file that is 2 levels above my main movie. Basically I have a main movie and I have actionscript on the timeline which corresponds to a button which loads a swf (eg my web portfolio work):
[Code]...
Then in this swf I have another button which again loads another swf on top to show a particular piece of work and the code on the timeline to correspond to the button is:
[Code]...
View 3 Replies
Jun 26, 2010
I'm learning on how to make que loader system. I'm loading in 30 images at once when the swf loads onto stage that contains moderate tween animations. I was wondering would I get better performance if I only allowed to load 5 images at once then next set 5 ect ect. rather than to load 30 images at once? I can't tell because my computer is very good so I can't hardly tell. Is this common practice?
View 2 Replies
Mar 18, 2010
Testing locally works fine but as soon as its on a server - published live - the images load random. It loads fine when you publish in flash.
Here is the code and below is the file she sent me.
Code: Select allthis._lockroot = true;
import mx.transitions.Tween;
import mx.transitions.easing.*;
var myShowXML = new XML();
[Code]......
View 1 Replies
May 1, 2010
I created an input text box, and depending on what the user enters, it will create a file with that same name. However, for some reason, it's deleting the last character of the filename when it creates the file. For example, if you type "House" in the input text box, then the file that it will create will say "Hous.txt"What is causing this and how can it be fixed?
View 7 Replies
Feb 26, 2010
[Code]...
Results into: Implicit coercion of a value of type Boolean to an unrelated type Number. Why do parentheses turn into Booleans into Numbers? Can't I use bitwise operations?
View 4 Replies
Apr 1, 2011
I have constructed this animation of a broken up image. If I just use the nested for loop in a new file, it will run normally but when i try to let it run after a TweenLite which has an onComplete function, the animation will be looped 4-5 times. [URL]
View 2 Replies
Jan 27, 2011
My movie is basically complete and consists of simple movie clips as buttons, these listen out for specific states and when these conditions are met a function is run which generally either plays a movie clip or runs a prevFrame loop.For some reason, although the mouse over and out conditions are working correctly the mouse down condition causes the variable to flip through 3 states which causes the panel im trying to show to basically run through 5 frames and then reverse for a single frame.I'm literally banging my head on my desk for a solution and my manager is starting to look at me a bit funny. Has anyone experienced anything like this before? Heres me code
Actionscript Code:
// import classes import flash.events.MouseEvent;// enable button mode for movie clipsmc_red.buttonMode = true;// Create variablesvar red_rewind:Boolean;var
[code]......
View 2 Replies
Dec 29, 2009
We're using :
JBoss 5
Flex SDK 3.5
BlazeDS 3, with integrated authentication (through JAAS and JBossSX)
Failed login are always indicated to the flex client by the same fault code : Client.Authentication
However, the underlying JAAS LoginModule throws a specific javax.security.auth.login.LoginException subclass.
How can we propagate the failed login reason to the flex client ?
View 1 Replies
Mar 31, 2012
What is the reason for the enormass bloating of FLA file size, when many edits and saves are made to a FLA file, yet assets are not being added to the library? What is the best technique to keep FLA files smaller in size? (with the problem described below. I am not talking about published SWF files or asset management)Over many edits and many saves of my FLA files, they become 30 times the size on disk from where they start out. Example 750k can get as high as 34mb. In the past "save and compact" used to fill the role of reducing FLA file sizes but now that feature is gone.When I save as a CS4 file then back to CS5 the file becomes much smaller after it has become bloated, BUT I take a risk every time I do this that the file will become corrupted (I've had corruptions happen).I have read that files which were created in CS5 and are never in the format of CS4 don't have this problem, but I find that theory unlikely since I have tried to follow this rule to no success.
I have also read that every FLA file tracks its "history" of assets. So adding and removing assets to the library will sometimes cause bloating because old assets that are removed from the library remain in the FLA file. This seems bogus because there is no purpose to this, but could be an indication of a bug in Adobe Flash Professional CS5, and CS5.5.Personal details: the files I am editing contain personally created flash components, images, audio, many symbols (20+) but no embedded video.For me personally, this bloating is a problem because I'm dealing with hundreds of flash FLA files that should be about 1-4mb in size but are instead much larger. The overall effect is that I end up with gigabytes of files instead of hundreds of mbs.
View 1 Replies
Mar 4, 2011
I have got a very obscure problem that I cannot for the life of me figure out. I have a flash movie which contains a number of pages which contain dynamic text fields containing HTML read from my database. This works absolutely fine, however for reasons that I cannot understand when you hover over some of my links they move to the right so they are inline with the edge of the first linked image at the bottom. The code is as follows:
PHP Code:
<p><a href="http://www.testlink.com">A LINK</a></p><p>Test text <a href="http://www.testlink.com">ANOTHER LINK</a>More text</p><p>
[code]....
View 2 Replies
Dec 25, 2011
I've (actually my classmate) got a problem with loading local ZEND_AMF services on Windows 7 (XAMPP). I can't find any answer on Google or on Stackoverflow. I found one similar topic without any answers: ActionScript 3 AMF Zend fails silentlyLet me describe the problem: I've developed the UI and dataloading for a Memory(matching) Game in FLASH CS5. The games uses data from an ZEND Framework website (you can add levels/cards/images there).[code]Everything works fine on my Macbook Pro (Using MAMP as local server), but a classmate (who's helping with it) of me that is using a Windows 7 laptop with XAMPP doesn't see anything. We're both using Flash CS5.5.For some reason his Flash isn't able to load local services. When he uses the same URL path like me Flash doesn't do anything in the responder. No Error function call and No Complete function call. We've been searching for the cause and tried several things.In a ZEND_AMF tutorial on the Internet we've found an online AMF Service and put that in the code. Of course we're using a nonexisting service function so the responser will call the Error function. And yes, this works. He runs the function returnError(). The cause of this problem is obvious: Flash on my classmates PC (using XAMPP) won't load local services. Allowing swf to correspond with non-local URLs (is an option where you have to add your swf to the Flash settings) => Has happened
View 1 Replies
Mar 31, 2010
A friend of mine has a Flash Action script running on a LAMP server that currently reads an xml config file. He's asked me if it's possible to remove the xml file, and replace it somehow with a system (lets call it an 'auto xml generator') that intercepts the request to read that file and generates an output, so it appears to all intents and purposes as if the file still exists and contains the contents that has actually been returned from our auto xml generator'
View 3 Replies
Jan 28, 2010
This is a problem that's best explained in code. I don't see how active_button.upState, which I know is a TextField (see trace statements), mysteriously turns into a DisplayObject when I try to access the textColor property. I've included the error messages below for reference. Also, why is it that when I have an object that I know is a SimpleButton (again, see traces) I need to cast it to SimpleButton in order to store it in a var? That doesn't make any sense to me.
[Code]...
View 1 Replies
Jan 5, 2012
Looking through our windows event viewer application logs, I've noticed alot of these warning listed. What would cause they messages to generated? Anything to be concerned about? It seems they're all created in between live event streams - after a live stream has stopped published and before the next live event stream begins, about a 20 minute break.
[Code]...
View 3 Replies
Sep 18, 2009
I have made a preloader, yet when i bring my SWF in that i want to load, it loses all the stops that have been put int it? So it just plays all the way through?
View 1 Replies