Flash :: EnterFrame Tween Calculation Returning Unexpected Result?
Mar 2, 2010I have the following bit of code:
protected function onEnterFrame(e:Event):void
{
var diff:Number;
[code].....
I have the following bit of code:
protected function onEnterFrame(e:Event):void
{
var diff:Number;
[code].....
I've created a series of calculations, and I've got that part down. Now, I just need it to show up in the movie.
I've created the dynamic text box in Flash (CS3), but when I hit test, it won't show up.
After all the calculations, I should have a figure that I call totalmoney. My dynamic text box is called total. The user doesn't need to hit anything for it to appear. It just appears as part of the movie.
Here's my code:
stop();
var startDate:Date = new Date(2010,0,12); // use your startyear, startmonth, startdate in the new Date() parameters.var currentDate:Date = new Date(); // assuming user's clock is correct and in your timezone. else use server
[Code]......
I ve a bit of missunderstood about functions: as i read the functions works:
basically 2 types:
named (can be lonely)
unamed (need and object)
- can i define a function wherever i want? ( _root, MC...) and call it from everywhere?, before or after i created it?
- if the variables of a function are local variables of that function. How can i store the result of a calculation of the function, in a variable outside it?
The symbols appear properly in the library. To edit the circle, I double click it on the stage.It appears to open for editing - the status bar above the stage says SCENE 1 -- SYMBOL 1 - but the square symbol on the stage DOES NOT gray out to indicate I am editing the circle I make changes to the circle and click out of editing mode, and yes, the changes have been made to the symbol in the library. So the editing process appears to have worked.
I overlook the square not graying out and begin writing my ActionScript, a simple script that changes the color of the circle or square in response to mouse overs. When I test the movie, the circle works perfectly but the square is unresponsive. It seems like Flash does not realize the square is on the stage.his exercise comes from the Missing Manual Flash CS5 book.When I download the completed exercise from their website and double click THEIR circle for editing, the remaining symbol DOES turn gray on my stage to indicate it is not being edited.My code appears to be identical to theirs. I have started over from scratch over a dozen times now, but I seem to keep making the same mistake.
I'm creating a login in Flash that connects to a MySql database through PHP.I'm using sendAndLoad() and the variables are being send to PHP without any prolems, however it does not seem to be returning any info resulting in a "invalid username/pass" message.I'm fairly sure the problem lies in the PHP but not too sure where! Do I have to declare the result_lv variable in the PHP somewhere? How and where?
[code].....
I created an full flash template website loading external swf.Lately, I managed to add a fake3D rotation with AS3 and CS4 to this global template with an enterFrame.some of my external swf use a vertical scroller also using an enterframe function base on the x / y position of the mouse, the scroller dont work anymore.Can't an enterframe swf loads another swf with enterframe function?
View 4 Replies59.99 + 10 = 69.99 is true.but if we trace it with flash as bellow trace(59.99 + 10 == 69.99)it says false.is the above condition is an exception?
View 7 RepliesI'm making a simple calculator, where user can enter values into textboxes and then hit the calc button. E.g.
this.sales_txt.text = "8.50"
this.buying_txt.text = "3"
var marginPerLitre:Number = parseFloat(this.sales_txt.text) - parseFloat(this.buying_txt.text)
trace(marginPerLitre) // = 5.5 <--
I need the output to equal 5.50
I'm suddenly getting an "Unexpected file format" error on virtually every Flash CS4 file that I try to open. These are files that I created and I'm trying to open tham on the same computer on which they were created. The only thing that I can think of that has changed is that I installed some new fonts, so I deleted those, but that hasn't helped.I've tried retrieving files that I had backed up to a server, and those give me the same error. The only files that I AM able to open are 1) a test file that I created in CS4, saved, closed and reopened, and 2) files that had been created in CS3.
View 1 RepliesToday I was working on a project in Flash, I restarted my computer because when I was pasting sth. It was pasting "Hello!". After the restart, I opened Flash, It said that the "Essentials xml" couldn't be opened. So it said to go to Window>Essentials reset. I did and I was able to edit again. But before doing that, I tried to open that project, and it Said that it couldn't be found. I opened it manually but still the same. Then I closed Flash and opened it again. And when I opened the project I got : "Unexpected file format".
View 1 RepliesI have been working on a flash movie all day.I shutdown my computer and rebooted it.Now when I go to open my .fla it says "unexpected file format". I stupidly wrote all actionscript on the timeline.
View 1 RepliesIf I have added Event.ENTER_FRAME listeners to different components, how can I set or know the ordering of when these events will be fired on each enterFrame?Instead of adding enterFrame listeners to individual elements, is it better practice to have one element which listens for enterFrame events, and has an array of elements needing updating on enterFrames, thereby making it easy to organize and change the firing order of these events?
View 3 RepliesWe recently upgraded to Windows 7 64Bit from Windows XP here at work, and since the upgrade i've discovered a very scary issue with Flash.When going to save one of my large projects, often Adobe simply crashes outright, freezing up and displaying a standard error message."Adobe Flash CS5 has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available." - with an option for "Close program"I hit close program, and Flash disappears. If I try and open that same FLA file again, I get the error messageUnfortunately it seems since Flash is crashing in the middle of saving, it is corrupting my FLA file. This is extremely worrying, since it corrupts my entire source file.Here's the details of my computer:OS: Windows 7 - Recently upgraded from 32bit Windows XPThe Flash CS5 version is 11.0.0.485The FLA in question is 10MB, and contains some large map files (gifs), lots of small JPG's as well as a fair chunk of code as well as importing of external classes. I've tried replicating the issue on smaller files, and haven't been able to do so.
View 27 RepliesWhenever I try to remove an object/child with enterframe running I always get null reference error.In my particular case, the setup is Battlefield contains a lot of Robot:
A child (Robot) dispatchEvent that it is destroyedThe parent container receives the event and starts removing the child by removeChild and remove the child from an array of Robots.on enterframe, during a loop to move the robots around, sometimes I would get null reference, so I have to call if (robots[i] == null) continue;
How do you safely remove the child without sprinkling if robot is null all over my enterframe?
what is meant by EnterFrame and it's use and how to declare it? And also the difference between EnterFrame and MOUSE_MOVE?
View 2 RepliesI am using the following code to load my flash file, contact a php script and decide what frame to play based on the results. THat is all working fine, the problem is that when the animation starts from Frame 2 - gotoAndPlay(2) - it seems to repeat a few frames over and over until the whole animation is complete.
I have done some reading up and the enterFrame is called many times so I can understand why the problem is there but I don't know how to resolve it. The interesting thing is, when I just use gotoAndPlay(2) in the if loaded section, it all works fine. It's only when it's in the onLoad for the loadVars that causes it to break. Using: Flash CS5 and Actionscript 2.0
[Code]....
In my application, I am using a ComboBoxs control and where in the init() of the mxml, I am defaulting the selectedItems to a subset of the list in the combobox.The combobox has a simple array of items:[code].....
View 7 Replieswhen the embedFonts is removed, it works perfectly as expect. Otherwise when an image is clicked, it selects the whole text around it. Alternatively can anyone suggest a method to style dynamic textfields instead of using html?
View 1 Repliesi am wondering if there is a way to put a delay (seconds) on the flashs' native tween class like you can on the laco tween engine... such as
[Code]...
I will have three seperate pages for the motion tween, mask effect and shape tween... would you make the seperately, in a different scene, as a symbol or on the same scene with the website.
View 2 RepliesIs there a way to convert a classic tween to a motion tween?
View 0 RepliesI have coded a map that when a province object is clicked on, it should move to the center of the screen and grow a percentage of the width, along with displaying a number of different things.
The problem is that in order for the image to resize it needs to be clicked on twice. It moves, and all of the children display just as they were designed to do, but the resize doesn't work on the first click.
menuItem4_mc.addEventListener(MouseEvent.CLICK, onClick);
public function onClick(mc:MouseEvent):void {
menuItem4_mc.width = width * .65;
[Code]....
I really don't understand how the results I get are possible.Here's my code:
ActionScript Code:
patch = 0;
//Assign the correct percentages using the data recovered from the database[code]..........
And, here are the traces I get:
Quote:
int_tmp: 66.6
int_tmp: 66.6
int_tmp after: 66.6[code]....
my code somehow manages to say that the result of 66.6 + 33.3 = 99.89999999999999
It might be possible in some alternate universe, but here on earth, I should get a result of 99.9... I'm really hoping one of you can explain to me why Flash returns that result, cause really, I'm at a loss here... this line:
ActionScript Code:
var int_tmp:Number = int((nbUserArray[t]/nbUserTotal)*100*10)/10;
I made sure the values are the correct ones, plus the traces confirm that the first time, it equals 66.6 and the second time it equals 33.3. So really, I don't understand how it can return this... monster of a result .
import fl.transitions.Tween;
import fl.transitions.easing.*;
var homemanTween:Tween = new Tween(homeman_mc, "x", Elastic.easeOut, 1000, 50, 3, true);//frist tween
var adobeTween:Tween = new Tween(adobe_mc, "alpha", Regular.easeOut, 0, 1, 3, true);//second tween
how can I animate the 2nd tween after 3 seconds when 1st tween stops.
So i think i have fully coded my calculator but it still doesn't seem to be performing the calculations correctly. I can't see where i am going wrong. If i perform a calculation let's say 6*2 it outputs NaN then i straight away + by let's say 5 it outputs NaN again. And it doesn't make the operators display only once, so if i click on '+' twice it will display twice in the display when it is meant to only display once and in one of my functions i cleared the display field so that it would replace the number's when the next operation is performed but it doesn't seem to be doing that. I have been going over the code several times but i can't seem to identify where the problem is coming from.
Actionscript Code:[code].....
I have not added the full code as it is too long, i have just added the parts which relate to each other. I am just doing everything entirely through actionscript, nothing is on stage apart from the display and answer text fields.
I'm trying to calculate age in flex. I've found this previous question url...[code]but I don't understand 100% whats going on.How do I go Implementing this into my code say if the date was 12/23/1990?Also How would I go about modifying this code to calculate the age if two dates are provided instead of using the current date? eg. 12/23/1990 - 10/15/1999
View 2 RepliesI have a actionscript calculation that initially calculates a value of infinity. Is there a "if" statement you can perform until the calculation actually calculates a real number (0-100)?
View 14 RepliesIs there a way to calculate the distance between the origin of a movieClip at, say, (x:500, y:0, z:0) and one at, (x:500, y:0, z:50)?? And lets say the vanishing point is (0,0) and the perspective angle is 50.
I know that the eq for finding the distance between two points in 3D space is:
d = ((x1-x2)^2 +(y1-y2)^2+(z1-z2)^2)^(1/2)
the problem is I dont know x2 (the x value of MC2 (the one set at z = 50)).
[URL]
So got a very odd result from a maths operation:
Code:
var myNumber = 6.3 + 9.1;
trace(myNumber);
[code]....
How to pass variables from flash to php to process and get back the result to flash
this is th php code
<?
$money = $_POST["fname"];
$persent = $_POST["age"];
[Code]......