ActionScript 3.0 :: Accessing Variable From As Files?
Apr 2, 2010
Is it possible to use variable on the frame in the actionscript file.
for example, I have a variable named levels on my frame, and in my action script file I want to use it in a if statement, such as if(levels>1){.
View 3 Replies
Similar Posts:
Oct 7, 2009
I have 2 AS files. One is my main file which i have as the Document Class. The other I am trying to get to be a "sub as. file" that will load when the main one loads. The main Class loads pictures through xml. The subclass, (I guess it would be called), loads all of the elements that I need on the stage, such as the forward and back buttons etc.
My main class is
Public Class Slideshow extends Sprite {
//I then put a var within this with as the name of my subclass:
public var stageElements:StageElements;
Now, at first when I published the flash it gave me some errors that were in StageElements class so I fixed them and it loads all fine now without errors and the pictures come up but the stage elements do not. I know that my StageElements class works because I have tried it out as the Document Class the .fla uses.
View 4 Replies
Oct 15, 2007
does anyone have a simple way of accessing files on the SAME server, but just below the web root folder?
I'm trying to do a 'loadSound("../../mp3s/filename.mp3", true); but I've found that flash doesn't like to access files below the web root.
View 5 Replies
Apr 10, 2009
I am trying to get my application to load images from my local hard drive. I browse to the image files (no problem so far) by when I select the file to load I get an input/output error. I CAN load images successfully if they are in the same folder (directory) as the Flash application I am creating. Is it possible to load image files selected from folders other than the active application folder?
View 17 Replies
Apr 18, 2010
How do I specify files to be accessed only in a specific folder via a crossdomain?
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "[URL]">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="[URL]"/>
<allow-access-from domain="*.newdomain.com" secure="true" />
</cross-domain-policy>
View 3 Replies
Feb 26, 2011
Is there any simple way you can access a very short sound file in flash without having to play it in an flv player. its just a ding sound to play when the user hits a button in the presentation.Also is it possible to access an external pic file and then convert it in to a symbol to be used within my presentation.I just don't want to store these files to keep my main swf small.
View 3 Replies
Apr 27, 2010
I have flash (AIR) application running on a single controlled system (there is only one computer running it and nobody has access to it).I will host some files on Amazon's S3 and I need to make sure that only my flash app running locally on that computer can access those files.I'm wondering what the best (most secure) approach would be for doing this.My initial thought is to make the files on S3 private and store the secret key on the local computer running the flash app. Then when I needed to access the files from flash I would send out an authenticated query string with some expiration time. The only problem with this is that I don't know how to generate the S3 signature in flash. Also I'm a little skeptical about storing the secret key on the flash machine (even though it's a privately owned machine with no other users using it).Is there a better approach perhaps?I have access to a server with PHP, so I could maybe use that as some kind of proxy, I'm just not sure how while keeping the file access secure and not creating a bottleneck through the web server (as opposed to direct access to S3).
View 1 Replies
Aug 26, 2009
my urlloader does not seem to like the idea of fetching something over the net.it just gives a Stream Error.
Code:
private function bar():void
{
var loader:URLLoader = new URLLoader();[code]..........
View 6 Replies
Dec 14, 2004
Short description of my project:I'm making a "flash-car-damage-registration-program" where a user can click on a part of a car, make two choices (from two comboboxes) that describes the damage, and then save it in a datagrid withing flash.I have split up the code in different class files:I have a damage.as class file that describes the damage and its properties.I have a carPart.as class file that extends the Movieclip class. This sets all the propertiesof each carpart and where the roll-over/out eventlisteners are, pluss som escriptive text to each carpart. This works the way I want it to. This is just to quickly give you an idea of what I'm working on.So to the real question or problem: I have a LoadMyXmlData.as class file where I load some xml data, this works fine. A function in this class takes a combobox and a xmllist as parameters.
I want to populate the mentioned comboboxes from the xml data. Both comboboxes are on the stage within another movieclip, but I can seem to access them. (yes, they have instancenames etc) I get error 1120: 'Access of undefined property'. I have tried ways like: containingMc.comboboxMc' and so forth but no luck. I have been searching the web for days for a solution to my problem, but nothing so far.
View 1 Replies
Sep 26, 2010
I'm scraping a website in Flash, writing in Python. I can see in Firebug that the page loads its Flash file and then some background data in an .asmx file. The background data is what I'm interested in - so how can I get hold of the .asmx file? I already know what it's called. I can't get at the .asmx file directly, but can I grab it using Mechanize?
[Code]...
View 1 Replies
Aug 12, 2011
I'm working on an image gallery application. Very frequently I'm getting Sandbox violation Error like Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.. Some times its raising by cleaning the project. Every time I'm using my application's backup and updating and then the error is raising. Though I'm accessing local image files, getting error. I'm using try-catch to catch the location but no use.
View 2 Replies
Mar 15, 2010
Lets say I have a movieclip on the stage.
On the stage on frame 1 I define a variable. Lets say its a string that reads "hello".
Now in my movieclip on stage I am trying to trace that string I defined on frame 1 on the stage. How can I make this happen?
I have tried a few things but I can't seem to get it working right.
View 1 Replies
Sep 15, 2008
I have a problem accessing a variable loaded from another swf. Actually the variable is a singeltone class, which needs to be initialized.It has structure presented in the last part of the message.The project has the following structure:
- main.swf - this loads all the other swf files and is their holder.
- assets.swf - contains some common elements and initializes the SingleTone class
- interface.swf - contains some interface elements and needs to use the SingleTone class
- all the three swf files have access to a common class structure, where the SingleTone class is defined.
Now, the problem I have is accessing the SingleTone class from the interface.swf file. If I try to send the SingleTone.singleTone. property parameter to the class I get "Type coercion failed: cannot convert from ClassName@.. to ClassName". If I try to access the SingleTone class directly from the interface.swf file i get "Cannot access a property or reference of a null object...". Both errors I get seem logical:
- if I send a parameter, I send the reference to that object, but the interface.swf file does not have access to the assets.swf domain;
- if I try to access the SingleTone class directly from the interface.swf file, I get the null error because the class is not initialized over the interface.swf domain.
Is there any work arround? I know a simple solution may be to initialize the variable over the interface.swf domain, but what if there is a variable that can only be instantiated in the assets.swf? Can I access that variable from another swf, or can I change the ApplicationDomain?
View 1 Replies
May 25, 2009
I've got two classes running...one is a document class (EgoGame.as) and another is a class linked to several similar movie clips (Ball.as).I'm trying to access a public variable from Ball.as which has been declared in the doucment class EgoGame.as.When I run the test the outputs states the following...1120: Access of undefined property _ballPlaced.Here's my code. What I'm trying to do is remove the event listeners from the Ball.as when the _ballPlaced variable is true, so that the user can't drag and drop the balls after they've been placed in a zone.
Document ClassEgoGame.as
package
{
[code].....
View 3 Replies
Feb 1, 2011
I have a variable declared in AS code on the main timeline, which I want to access from the timeline of an underlying movieclip. How do I do this?
View 4 Replies
Oct 12, 2011
here is the wrong script:
var Var1:int=1;
var Var2:int=2;
var Var3:int=3;
[Code]....
View 2 Replies
Feb 8, 2012
Here is my code in my main timeline:
var loadit = new Loader();
loadit.unload();
loadit.contentLoaderInfo.addEventListener(Event.COMPLETE,mcLoaded);
[Code]....
View 11 Replies
Jan 20, 2009
ActionScript Code:
package
{
//import ....
//First Class
[code]....
A seemingly trivial problem, however, the variable "code" 's value would not change! Note: I've tried to add parameters to the constructor of B, as a way to use B, but I had error of " #1063 - Expected 1 , Received 0" for that one even though I've added parameters to it.
View 3 Replies
Jun 17, 2010
I searched for external SWF and got 500+ results but i couldnt see what i needed.Lets say you have a basic SWF file which contains a ball whose instance name is ball.Is it possible to load this SWF and access ball by name?The issue i have is that lets say you have 12 different heads... I need to load these heads in when required.. but each head.swf has a sprite called skinColor. need my main movie to have access to the skin layer sprite so i can Tween it. SWFs have much more details, but the skin sprite is on the bottom layer... so i cant just "color tween" the entire SWF.
View 1 Replies
Jul 30, 2010
if there is a way to access XML attributes by replacing the actual attribute name with an ActionScript variable?
For example:
Code:
var myXml:XML = <root> <child id="child1" /> <child id="child2" /> </root>;
var propToAccess:String = "id";
trace(myXml.child.@{propToAccess});
As you might expect, this throws a compiler error. Hopefully it gets the point across, though.
View 2 Replies
Sep 25, 2010
I'm accessing my json data like this:
ARRAY[0].data1[0].data2
and it works ,but could I substitute data1 or data2 with variables( strings) so that I can construct this kind of paths dinamically?
View 1 Replies
Jan 4, 2011
I'm having trouble setting up my Ball class so I can set a variable which I can then access in another class later. I'm under the impression you can only do this with a public static var, but when I try to make my variable public static the code doesn't work.
[Code].....
the code checks where the balls are on the screen and moves them onto the square. I want to set a string variable for the direction its moving eg. "right" for the ball that's moving right. I'm not sure how to access this in another class.
View 1 Replies
Jan 4, 2011
I'm having trouble setting up my Ball class so I can set a variable which I can then access in another class later. I'm under the impression you can only do this with a public static var, but when I try to make my variable public static the code doesn't work.
Code:
Select allpackage {
import flash.display.MovieClip;
import flash.events.Event;
public class Ball extends MovieClip {
public var _startX:uint;
public var _startY:uint;
[Code] .....
The code checks where the balls are on the screen and moves them onto the square. I want to set a string variable for the direction its moving eg. "right" for the ball that's moving right. I'm not sure how to access this in another class. Here is a pic of the screen to visualize.
View 1 Replies
Feb 23, 2009
I would like to access an xml node through a variable.
something like the following:
Code:
my_images = myXML.(myVariable.name).IMAGE;
but of course it does not work.
View 2 Replies
Jun 24, 2009
I have successfully loaded an external swf inside my main swf. Now, I'm unable to try to trace a variable of the loaded swf from my main swf....
Code:
// Create site request
var siteRequest:URLRequest = new URLRequest('site.swf'); // 'site-' + siteAmbiance + '.swf'
[Code]....
View 6 Replies
Dec 14, 2009
i would like to access a variable from a child in as3.on main time line i have:
PHP Code: [code].....
the trace output is NaN.how do i read xx fom inside mc?
View 4 Replies
Aug 10, 2011
I have an mc with the variable called "Section" and I want to be able to change the contents of this variable from another MC. I have tried MovieClip(parent).mcInstanceName.variable = "normal"; But that doesn't work.
View 1 Replies
Nov 2, 2009
I am creating a web page that allows users to upload their own swf files to my web page, which are then used by the main web page as components. This creates a security issue though because I don't want the uploaded swf files to access other files on the server.
when the main webpage starts, it loads whatever third party swf files the user specifies. Is there a way for my main web page to change the security settings of the loaded swf so that the loaded swf is treated like it was loaded from another domain? Or is there another way I can provent these uploaded swfs from accessing local files on the server.
View 5 Replies
Apr 24, 2009
I work with FlashDevelop, Flex SDK and FP10 debug. I am able to access a local variable (xcorner) which is never declared before, at the condition that it must be declared after... in an "if" for instance. If I remove the declaration of xcorner, within the if, errors occur at compilation, but otherwise it works.
PHP Code:
public function pushShape2Pool(name:String, sh:Shape, rotAngle:Number = 0):int{
[...]
// xcorner is NEVER declared before !!!
coordSprites[0] = new Rectangle(xcorner, 0, globalBmp.width, globalBmp.height);
trace("xcorner=" + xcorner); // display 0
xcorner += globalBmp.width;
[Code] .....
View 7 Replies
Aug 27, 2009
This is probably a fairly easy answer, but I can't figure it out. I have a dynamically added child, and I have a dynamic text box on the parent. I'm thinking that it should be possible for me to add to the text box from the child timeline, but I don't know how to target the text box.
View 1 Replies