ActionScript 1/2 :: Including A Script File That's Not A Class?
Oct 10, 2009I have some common code I would like to share between a few flash appliations, but this code is not a class, how do I include it?
View 3 RepliesI have some common code I would like to share between a few flash appliations, but this code is not a class, how do I include it?
View 3 RepliesI'm creating a flash 3d website for a company. The idea is that there is one overall swf file - this holds the navigation and design. Once the user clicks on a button, it goes to frame 10, I have included the following script to load a swf file
loadMovie("deepbartesting.swf", maincontent);
this.onEnterFrame=function(){
if(movieClipName._currentframe==5){
[Code]....
the preloader works, but instead of going to frame 2 of that swf file, it goes to frame 2 of the overall swf that holds the navigation. Does anyone know how to get around this so that it goes to frame 2 in the same swf file as the preloader?
am new to flash and am trying to create simple program, I kinda know how to code the program but its really difficult to interpret everything into action script. For example I created class file in file node.as
[Code]...
I'm dabbling in OOP, but I'm nowhere near proficient yet. I have two classes, house() and town(). In house's constructor, I want to define an exit from the house to town. I've set up a Doors and Exits array in the base class, and in house, I add town to it:
Doors = new Array(new trigger());
Exits = new Array(new town());
This way, I can check if the player is colliding with the trigger, and if so, I can set level to Exits[i] or wherever it is. My problem is, including Exits = new Array(new town()); in house's constructor calls town's constructor, and town has an array Exits, which leads back to house and so on. So my question is: How would I get around this problem or structure my level class? Is it possible to use "town" to get to new town(); without manually checking if("town"){ new town(); } etc. Basically, I want to tell flash to create a new town() WHEN I need it, not necessarily during the initial construction, but I don't want to have to manually call "new town();"
For some reason, my XML code below is loading EVERYTHING in the XML file including the tags, unicode...everything.
[Code]...
In mxml application made in flex if i place a part of actionscript code in separate file and include it in mail application using (fx:Script source) , then do i have to import all the mx and spark components in .as included file even though they are were already imported in main mxml application ? For example if i have mx alert already imported in main mxml file then will i have to import in again in the .as file placed externally although .as file is included in main mxml application ?
View 1 Replies[Code]...
Is there any way at all I can define the file I need loaded in a variable and include the file that way? The only other way I can think around this issue is incredibly labour intensive and takes me places I really don't want to go (like dynamically writting script heavy AS files using PHP, no fun). PS. There seems to be an error in how this forum displays #include's
I have developed a small website in flash 8 ...
- The website has content (text) which is loaded externally
- The images are also called externally with 'loader' component
- I have added a preloader at the beginning of my file
But still when I loaded it on the server....the images and the content is coming slowly. Some way to load the whole file completely at the time of loading (including the external content)?
I have some files in my src directory, some are .class files (Java class files) and some are .properties files, when I create the Adobe air native installer these files are not included. Why is that? How can I work around that?
Also it excludes .mxml files, but that's good. I'm sure that's related, how to change what it includes or excludes?
Does anybody know how to apply this text effect [URL](including the blinking underscore) to a text field that loads from an external .txt file.
View 6 RepliesI am trying to pass XMLList from one class to another class using public function get.
Below is the code I am using.
XMLContents.as
ActionScript Code:
package com.ad.loading
{
/**
* ...
[Code].....
The problem is I get a "null" on trace.
I am trying to write a class file using a .as file instead of writing code into the script tab of a .fla file.When I write stage.addChild(img); I get an error that stage is null. When I take out stage, and just write addChild(img); the code runs fine, but nothing appears on stage. Do I need to do something to set a stage active?
Is this because I don't have a Main class? My class is named after the file and I don't have a file named Main.Here is the code. As it is, it runs and I get the two trace outputs, but no graphic on my screen.
package { import flash.display.DisplayObject; import flash.display.Sprite; import flash.display.Loader; import flash.events.*; import flash.net.*; public class HelloWorldImage extends Sprite { private var background:DisplayObject, foreground:DisplayObject; private var url:String = "hw_jpg.jpg"; private var loader:Loader = new Loader( ); public function
[code].....
i) Create a symbol called SimpleSquare. This should consist of a simple red square graphic
ii) Create a class file to define a class called SimpleSquare. This should be linked to the SimpleSquare symbol. SimpleSquare ashould have the following functionality: When the instance is placed on the Stage, it should start to disappear by decreasing its alpha at 0.01 in every frame (hint: alpha)
I found myself loading a new XML file every day and so decided to create a small class that will load the xml file and return it.The class is loading the file but when i try to return it to a new xml object in the document class it doesnt load it.I think that it's something to with the return being in a nested function but i tried a few ways and non seems to work.
[DOCUMENT CLASS]
loadXML:LoadXML = new LoadXML();
myXML:XML = new XML(loadXML.loadXMLFile("gallery.xml"));[code].....
I'm trying to create a new instance of a MovieClip when the original one has been used. Would sound easy enough. Just use: var
instanceName:ClassName = new ClassName();
the class name/mc in the library im trying to duplicate is MCg1 so
var instanceName:MCg1 = new MCg1(); right?
However, the particular object in the library i'm trying to duplicate has a base class that is an external class file (just to control it's drag drop functionality)... i.e baseclass is not set to the standard flash.display.MovieClip, or whatever the case maybe. So i end out with a: TypeError: Error #1009: Cannot access a property or method of a null object reference.
I need to call the class into to my control as file. The problem I'm getting now is this error. "environmentTab.lightsButton.addEventListener(MouseEvent.CLICK, selectLights);" environmentTab is a instance name of a movie clip that is on the stage of my .
View 2 RepliesIs there a way to link to a class file from the timeline rather than using the Document Class? (I tried using the document class but it messed up because of the nested movie clips and stuff like that... so I need another way)
View 3 RepliesI have been practicing and trying to understand how classes work and I was wondering if it is possible to create a class that can be reused by declearing the class only once in my fla file. Rightnow I create an instance of the class than I asign it to a MovieClip the problem is that I can only use it once and if I want to use it again I have to create another instance of the same class, something like this.
[Code]....
i want to add to stage a movieclip in another class not the .as file as the same name of .fla file how can i get this.When i run same code in main.as i get the result but in another class it runs but no result.
View 2 Replieshow to call one class in other class file
View 3 RepliesI know this is simple - but I want to do a slideshow without XML. I want to include the image files within the .fla but I'm trying to find a way to make it scroll through 3 images included in the file with a fade in/fade out effect. But I don't want to make it so I have to tween the images (alpha) to fade them in and out. & I want it to loop.
View 3 RepliesI have a question for u, is there a way to include a win media player in a flash application to play a live stream generated for win media player?
View 2 RepliesIve been trying to include an swf with buttons, that plays .flv videos, into this html page: [URL] (feel free to view source) Im having trouble because i think the swf 'links' to flv files, and neither are in the same directory as the html page - the swf is just not showing up. i dont want to duplicate the swf and its corresponding flash files if theyre already hosted once by this client - does anyone have a solution, or is the problem actually something else? the swf files can be downloaded at: [URL]
View 1 RepliesI am using FlashDevelop 4.0.1 RTM to create a simple Android app and I would like to ask how to include external assets (images, xml & sounds located inside the bin folder) to the apk package.
View 1 RepliesI am developing flash app to be embedded in the html page, and i have some text in the swf file with certain font.Now,on platforms that does not have those fonts, it will definitely display different fonts than the one I originally intended.I could use the character embedding feature, but there seems to be only two options.One is include all the glyphs which make the file to be monstrous size or
there is an autofill button which will only embedded letters of the font that are in the swf file.Now the problem with the second approach is that,the word will change dynamically making the second option useless. i.e. if word (thus letters) change such that it contains letters whose glyph or whatever is not embedded it is a problem you can see.
Plausible solution for me seems to be include all the letters for desired font, which I could not figure out how to do it or if it is possible to do this at all.Or if it is possible to just copy those fonts into one of my web hosting folders, and dynamically loads them.
[URL]... I need that in my flash site, no-one can help me with making it, so how can i include that instead?
View 1 RepliesI would like to have a search engine on my website and found something nice to use for this.The problem is when I make a symbol of this search engine and put it in my site it does not include the "database.xml" anymore.Here is a .rar file with;a working search engine on root (try searching for: Illustrator to see it working)a not working search engine in a symbol (try searching for: Illustrator to see it doesnt work)
View 1 RepliesI have a few custom classes stored in AS files. Is it possible to have these classes imported another way from using the following method:
Code:
import ClassFile;
I want to have the AS files loaded from a server (policy file created for inter-domain talk) into to flash. Also I want it to work, if a person downloads the main SWF and plays it on their compy,i want the class files to be loaded from [URL] and so on.
I'm struggling with something that is supposed to be so simple! I would like to add an image to an input text box. I have a guestbook where the visitors can leave their comments. Under the message box I have a line of different smilies. The user types in the text and clicks one smiley to insert it into the box. I'm doing it like this:
sm_01.onRelease = function() {
mcData.txtComment.htmlText += "<img src="images/sm_01.jpg">";
}
The smiley appeares but it breaks the line and the subsequent text will be placed before the smiley and not after it as it would be normal. If I'm inserting text on mouse release instead of the image everything seems fine.
I have a class file that displays a slideshow and preloads each image in an xml file. the code is below. What I want to know is, is there any way to improve this code?
Code:
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
[Code].....