ActionScript 2.0 :: Flash8 Error In Calculation (yahoo Finance Variables)
Oct 24, 2010I programming a calculator, I get data on Yahoo Finance ( URL... ), but sometimes I get this error "NaN".URL...[code]
View 1 RepliesI programming a calculator, I get data on Yahoo Finance ( URL... ), but sometimes I get this error "NaN".URL...[code]
View 1 RepliesI programming a calculator, I get data on Yahoo Finance ([URL]..but sometimes I get this error "NaN"
I need some orientation, You can download the file
[Code]...
I'm able to format and display the text within my swf, however once its uploaded to the internet - the text either won't show up, or the flash player shows a security error "flash player is trying to communicate withI've tried to feed the data through to my own domain, but I'm not sure how to program for it. I've found php examples online, but I'm not sure how to implement them either. I need the stock quote price to display and update either once a day, or only when the swf loads. Currently I'm using the following code to retrieve the data (within flash):
fl_TextLoader:URLLoader = new URLLoader();
var fl_TextURLRequest:URLRequest = new URLRequest("http://finance.yahoo.com/d/quotes.csv?s=SNA.V&f=l1sd1");
[code].....
I'm making a game based on pong. At the start of a round, the ball will go in a random direction and when the ball hits a paddle the ball will move in a certain direction depending where it hit the paddle. The more centralized the hit is, the more straight the bounce is. Here's the tricky bit: the ball may hit either a vertical or horizontal paddle and I want the xspeed(horizontal movement) or yspeed(vertical movement) of the ball to increase/decrease in proportion to the opposite speed while keeping the same general speed of the ball(it can decrease and increase). Here's an example(you might want to get a pen/pencil and a piece of paper):
Let's say the ball is moving at 45 degrees(so it's going downward right) and hits a horizontal paddle smack dab in the middle, thus it goes at 270 degrees(straight up). So, at first the xspeed and yspeed are both the same, then the xspeed is zero and the yspeed is at the max(to the general speed).However, let's say that the ball hits the same paddle but at the edge(either edge will do the same) thus making the ball go at a near 360 degree angle, making the xspeed near max and yspeed almost zero. Like I said, I want the two speeds to increase/decrease in proportion to the general speed, this is so that xspeed or the yspeed don't exceed the general speed.
I'm trying to use the Astra library from Yahoo but I'm getting an error saying the base class BaseScrollPane is not found. It appears to be imported from fl.containers.BaseScrollPane, which leads me to believe it should be a part of the base flash 10 library and therefore should be available, but it appears to be missing. Is this part of a separate package from somewhere?
Update: For what it's worth, I found the actual class files in the Configuration/Component Source folder on my hard drive, but adding that to the class path (as well as the Components directory) did no good. I ended up fixing the issue by dragging a scroll pane component to the stage from the Components window and then deleting it, but I'm not sure what exactly that action changed that made it work, and would like to know for future reference.
So got a very odd result from a maths operation:
Code:
var myNumber = 6.3 + 9.1;
trace(myNumber);
[code]....
just getting the grip around the variables and im experimenting. This is what i have as a variable
money = 1000;
health = 100;
Then i have the dynamic textbox that shows them. works great, and i also have various effect that makes the two go up and down. Here's the problem, or more, how i would like to expand the concept but is stuck on. Right now both variables can go as high and low as possible (of course). Is there something i can add in that script that makes so the money variable can't go below 0. Also is there something i can add so that the Health can't go ABOVE say 500 and when health reaches zero (or a negative) this triggers _root.gotoAndPlay("gameover"); you get what im trying to achive here
Is it possible to put variables in an array?
For example:
Code:
var positions:Array = new Array(Stage.width / 2, Stage.height / 2);
When the above code is executed, the values "Stage.width / 2" and "Stage.height / 2" are replaced with the number values and the array becomes, for example [500, 400].And when I call the array positions[0], instead of getting the value of the Stage.width / 2 (considering the stage has been resized), I get the static value of 500.What can I do to get the value of Stage.width / 2 ?
My variable from the root timeline is not being sent to say a timeline inside a moveclip. This is basically my code:
On root timeline:
Code:
stop();
showred = false;
Inside movieclip instance 'infobox' on timeline:
Code:
stop();
if (showred == false){
play();
}
the showred variable inside the 'infobox' movieclip is not detecting that I set 'showred' to false on the main timeline.
what is wrong with this syntax
_root.range+towerID = 75;
i want flash to read the variable as _root.range2 = 75. this is for each tower so _root.range2 -= 10 reduces tower 2's range by 10 (this is done on a different frame thus the _root. is needed)(towerID is calculated above)
Ive got a script lined up:
Code:
onEnterFrame = function(){
if(aktiverPublisering == "true"){
function avpubliser(){
[code]....
Ive checked if "aktiverPublisering" traces "true", and it does (it declares "true" through a button)... So, here's the weird part...i cant get a trace inside the IF statement i.e. its not working...
Actionscript Code:
if (Key.isDown(attack2Key)&&shot2reload == 0) { for (i=1; i<2+1; i++) { shot2++; shot2reload = 30 var newname =
[code].....
Can you recommend good financial chart (like one on Google finance)?
View 1 RepliesSo I have a laser game I'm working on and I have a setInterval set up for when the laser button is pressed that it shows the laser for a little bit before removing the incoming asteroid and hiding the laser. I have a four of these buttons each with different colored lasers. So I thought it would be easy to pass the movie clip in through the function, cause I've done that with regular functions. Problem is, I don't know how to do that with a setInterval function. The way I have it set up shows the lasers then crashes and just shows a blank screen. Here is a bit of my code:
Code:
function laserMultiFire(laser:MovieClip) {
if(astroid == true){
_root[laser + "L"]._visible = true;
[code]....
The btnMulti is one of the buttons, and there are three movie clips that represent the lasers, the ones I'm trying to show and hide here are mcLaserMulti, mcLaserMultiL, and mcLaserMultiR.
I want to reference clip with some variable name because i want to change dynamicaly target clip. Example:
myMC="testClip";
myMC.my_txt="some text";//this doesn't work
//but this works
eval(myMC).my_txt="some text";
I guess eval() is not right thing to do.
I've read on the net that actionscripting from the action layer will result in a more readable file once published, as apposed to attaching onClipEvent functions which slow down readability.
For this reason I am trying to add variables to a MovieClip I have on the stage with an Instance Name of Player. However I wish to assign the MovieClip variables from the actions layer using the MovieClips Instance Name.
[Code].....
I'm trying to import some variables set up in a .txt file. However the variables that I would like to behave like numbers are not doing so.
I have a variable in the text file called "&middleimg=1" when I pull this in and say do the following:
Code:
var numvar:Number=0;
numvar = _root.myvars.middleimg+1;
I get "11" rather then "2" as the result. I tried setting up my text file as such: "&middleimg:Number=1" but get an "undefined" result. Is there anyway to get imported variables to behave like a number instead of a string?
how to pass variables from a parent swf to a child swf loaded into a movieclip container within the parent swf.
View 6 RepliesI'm trying to consume Google Finance API on a Flex Project but with no success. I want to use the ClienLogin mode, am able to get the auth token, but then I can't seem to get information from any of the feeds!
I've tried some of the few examples I found by Googling but still can't get it to work...
Is there a way of tracing variables in an object without expressly listing each of them?
e.g.
Code:
so.data.thename="derek";
so.data.thenumber=1234;
so.data.sex="male";
[Code].....
I am making a game using AS2, in which the user controls the character with WASD. I am making a tutorial level in which the level only advances past the first frame after the user has pressed W, A, S, and D. The level is a single frame in which there is a movieclip that has all the enemies. I made an offscreen button in the movieclip which has the code
Code:
on(keyPress "w"){
var w:Boolean = true;
}
[Code].....
When I run it, nothing happens and it stays on the first frame of the movieclip. No errors are shown in the output panel.
My movie is very lengthy one.when i publishing i am getting error like this
View 2 Repliesim having a little trouble with the maps api, im trying to make is so that the map reads addresses from an xml file and updates it on the map
[Code]...
Is there an API to implement Yahoo chat in Flex? Or at least some calls?
View 3 RepliesI'm currently working on a Flash website project that uses Yahoo messenger.Can we put a Yahoo Messenger on a Flash Website?If just like a HTML website i know it can, but i don't know if we can use the YM like chat with me in a flash website..
View 1 RepliesI need some brilliant Flash experts to weight in on an article we wrote at the advertising agency I work for. We put an article together about the ability for Flash to be indexed by Google and Yahoo. It's a two sided debate between Search Engine Optimization (SEO) guys and Flash guys. SEO is killing Flash right now in the debate.[URL]
View 1 RepliesIn the past week it appears that Yahoo has changed their crossdomain file to only accept Yahoo domains [URL]This is causing my applications that use Yahoo Maps to stop working (i.e. security exception). I cannot proxy the calls to Yahoo because the URL is embedded in the MXP file that Yahoo distributes.
View 1 Replieshttp:[url]....Is a 404 page. Does anyone know the location of the file?
View 1 RepliesI am changing over one of my projects from google maps to yahoo maps and was wondering who out there has experience with the yahoo maps api. Below you will see the code i was using with the google maps api to create custom markers using a library item as that marker. The library asset has some variables that need to be defined as you will see in the first part of my for loop. and this function needs to clear all the previously created overlays, before the for loop is run.
[Code]...
My problem occurrs when I change the yahoo written example:
[AS]
import com.yahoo.maps.tools.PanTool;
import com.yahoo.maps.markers.CustomPOIMarker;
myMap.addEventListener("initialize", onInitMap);
function onInitMap(event:Object):Void {
var panToolanTool = new PanTool();
[Code] .....
Ive taken out the EventListener as it never picked up onInitMap() and displayed the map without it, maybe this is where the problem is? It even recognises the text if you put lots of text into the description, as in it make the bubble alot wider but just doesn't show the actual text.