ActionScript 3.0 :: Checking If A Swf Is Already Loaded?
Aug 28, 2009I want to know how to check whether a SWF is loaded or not.
View 10 RepliesI want to know how to check whether a SWF is loaded or not.
View 10 Replieshow to check whether a SWF is loaded or not.
View 3 RepliesI am currently writing a site and one of the things it does is read variables from a database (by using the following code to access a php file which does the database lookup): loadVariablesNum ("loadvariables.php", 0, "POST"); This works perfectly, however following this I load a number of images based on the variables that are returned. i can't work out how to put an eventlistener, or something similar, so i can tell when loadvariables.php has finished loading. Then i can just load the relevant images in the oncomplete section (or the equivalent).
View 4 Replies[URL]
I'm trying to use .loadMovie to load a .swf that contains a high res background image for the website. I want it to load hidden behind a layer of black before the user is even presented with the oportunity to move forward.
Is it possible to put somthing like this on the first frame (a black screen)...
Code:
choice = Math.round(Math.random()*13);
switch (choice)
{
[Code].....
then have the second frame contain a button that will reveal the loaded image, but not until the code above is executed and the image is loaded?
I have this flash timeline with an empty movieclip in it. And i have some button that attaches an 'actionscript-exported' movieClip from the library..[code]Now...each time i press that button, the 'some_mc' loads. Is there some clever way of checking if the movieclip has already loaded, so that it doesn't load if it's already loaded.[code]
View 6 Repliesim making a sort of a game and depending on what u choose u may load 1 of 3 or 4 options of movies into a specific level for each option. Meaning: the different toy hands are allways loaded on level 3, no matter which u choose and so on. At the end i need to make a list of the choices the user did, so i need to know if "hands_blue.swf" is loaded in level 3, and if so then push."hand blue" into an array. Im trying this on the _root frame,but no matter what option i take, i allways get the same option:
Code:
list=new Array();
if (_level(3)==="hands_blue.swf") {
list.push("Selecci�n: hand blue");
[Code].....
What is the best approach to add and remove sections if I'm using this method for example.
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("section1.swf"); [code]......
Do I add this to button click events? for every section? and a remove method for the other sections that are not in use? or is there a better way to setup this more reusable and checking correctly if a swf is loaded or not?
I'm using a preloader and MovieClipLoader to seemingly good effect and I have an ending sequence to my preloader where it plays out once the target clip is loaded. The ending sequence features within the preloader itself (preloader_mc.endingClip). preloader_mc plays through its frames with:
[Code]...
until it gets to 100% and then gets to a frame telling endingClip to play. All good unless the target clip is already loaded. Then what happens is that the preloader jumps to 100% and only plays the ending sequence. I would like to have a way of checking to see if the target clip has already been loaded so as to avoid displaying only this ending portion of the preloader.
[Code]...
I have a main movie and into it I am loading an external SWF, using loadMovie("myclip", target_mc). I want my main timeline to be able to tell where my loaded movie is, and when the loaded mc (myclip.swf) reaches frame 20, i want my main timeline to do another action (like, start playing a sound). How do I accomplish that? How do I check what is the current frame of the external mc?
View 3 RepliesI am loading an external text file. What I want to be able achieve is see if a certain dynamic text box has text/image loaded in to it.[code]
View 2 RepliesI have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.
I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.
[AS]
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);
[code]....
When I test, it comes back with the trace "doesent exist", even though it does exist.
I must admit I have struggled with this thing for a bit. It seems simple but for whatever reason I can't get it to work. I just want to make something move in AS 3 right now, and so far I've tried puzzling together two different tutorials, but both of them are missing either some source files or further explanation.
Anyway, here is the code (The bit I am having problems with)
Code:
//event listener checks for key presses
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkkey);
//Create keyHandler function
[Code].....
The problem is the checkkey function in the update function. If I leave the parenthesis empty it tells me it needs an argument, if I leave it like that it tells me I need a right paren before colon.
What kind of code would one need to check for collisions between two symbols? I am hoping to become a game designer so this is important for future references.
View 8 RepliesI have a gallery loading jpegs from an xml file into a mc called mainPicArea, on frame 5. I have other content on frames 1,2,3,4,6,7.I want to run an if statement to check whether mainPicAreaexists and if it does, then run a removeChild(mainPicArea), and if not do nothing.
code:
if (MovieClip.mainPicArea){
trace("exists");
//removeChild(mainPicArea);
[code]....
this is my code. When I test, it comes back with the trace "doesent exist", even though it does exist.
why this code works on my other flash file and it doesnt on the new one. This is the code:
if (test == "PRIZE1"){
trace ("prizes/prize1.jpg");
}
[Code].....
Basically it should check whther the variable has any of the above words loaded on it dynamically so that it loads a movie that corresponds to it. I put the trace on the above so I can track whther it was reading or not. Obviously it wasnt. My publish settings are Flash Player 8 with Actionscript 2.0
Google is ranking my site preety high BUT (bigBut) in MOST searches it lists my swf-s not html pages. So when clicked they are shown in a browser window as single swf-s, not as part of html page. I am trying to workaround this by means of some variable to inspect if swf is opened as standalone or within a html.Here is the problem. I've set up a swf (swf_01 for example) in html page that loads another swf (swf_02) which is in swf_s directory. Swf_01 establishes a variable _global.isActive = 1; when html loads swf_01. So if swf_02 is loaded into the swf_01 variable is TRUE and that is OK and if the swf_02 is loaded directly from search results as a standalone swf it's not OK. That works so far. In swf_02 there is a code that checkes if variable is undefined (meaning that swf is loaded directly from search results) and, if it is, loads the right html into "_self".Somehow it's not working. Maybe my code isn't right.
Code in swf_02 (loaded one):
/if(isActive==undefined){ loadMovie("http://www.mydomain.com/index_services.htm", "_self");} // meaning: if variable is not true > this swf is loaded into browser directly from search
[code]....
I'm sure there is a very easy solution to my problem, but I haven't found it yet. My first frame consists of one input textfield, and two buttons. This textfield is sort of like entering a code to jump to another frame. "no" is a button if you don't have a code, and "go" is if you want to submit a code. Here is my Actionscript:
import flash.events.MouseEvent;
no.addEventListener(MouseEvent.CLICK, continueF);function continueF(e:MouseEvent):void{ nextFrame();
[code].....
I need to know if it's possible to check to see if a variable contains any information or if it's just blank basically I have a text file on the server that may or may not have a url in it, I have my flash file programmed to grab the url from that text file and apply it to a button that when clicked brings up that URL...but that text file may not always have a URL in it, so for those times i want the button to not be clickable, or at least not attempt to go to a URL.
[Code]....
Each button has 3 different animations on the same timeline: one for when you mouseover, one for when you mouseout, and one for when you click. Each animation ends with a 'stop();" command, obviously. However, when someone mouses over, then out of a button quickly, it interrupts the "over" animation and begins the "out" one, which looks choppy and awful. I need a way that when I mouseover a movie clip, a variable within said clip changes to 0, and when I mouseout, it changes to 1.
The big problem comes with the fact that I have multiple buttons with listeners, all of which use the same generic function to respond to mouseover/mouseout events. Is there a way to set up a variable associated with each button, then call the specific variable within the generic function?
ActionScript Code:
button1.outcheck = 0;
button2.outcheck = 0;
button3.outcheck = 0;
[code]....
Is there a viable solution, or will I have to just rethink the entire animation?
I have two movieclips. I would like to check if both movieclips have been rollOvered and then do an action. You can't rollOver them at the same time. So, I need something like: if movieclip 1 has been rollOvered and movieclip 2 has been rollOvered (no matter what following order) , then do action.I tried this using booleans and an if statement but no luck.
View 1 RepliesI am trying to figure out how to check when the key "A - Z" is pressed...How can I use ASCII characters to check this?, or even if I check something like this
if(Key.isDown(Key("A")))
How to check when keys A-Z are pressed, preferably something like this
onKeyPress("A") = function() {
"run code"
}
Anyway to do this? Basically hotkeys, press "s" to call a line of function that will save the game.. etc...
i made my site with levels so there are lots of swf's being updated, and i cant seem to get some of them to work. i think that my problem is that the swf's are being stored on the cache so when i update them, it doesnt reconize that its a new swf
is there a way to put in code to when someone goes to my site, to check their cache to see if there are any newer versions of the swf they have on my server?
and if it is possible, MAYBE making it so i dont have to put it on EVERY button (but if thats the only way fine i will live)
I do math applications for the web. Often I have to check if a user input is correct. For example: the right answer is 3x+5. Is the user input that.I do this by checking character by character. I don't think that it is the best way, especially since the user may have written 5+3x, which is right, too, although it is preferred to write the other way around.I sometimes have to check more complicated expressions, like -3x^2+7x-15 or -2 sin (4x^2).Right now I'm doing an equation solving exercise. There I have to check what the user wants to do to the equation, like +2x or /(-5).
View 2 RepliesMy page has 2 tab menus. When the page first loads, it defaults to the first tab, but when the second tab is hit, an image is loaded to the stage. I want to remove the image from the stage once the first tab is hit again.I keep getting the error "Access of undefined property Image1" but the whole point is to check if this child exists with the if statement.
//Tab 1
if (Image1 != undefined) {
stage.removeChild(Image1);
[code]....
I want to use an external actionscript file for a set of variables for a movie I'm working on.
However, as I cannot guarantee that the external file would be available (it's for our sales reps to use on their own laptops) is there a way of testing for the #included file?
My idea is that the integrated script looks for the external file: if it finds that file, it is used. If the external file is unavailable, the internal script defaults to its own variables.
The problem I've found that I keep having and that is pretty recurring between a few of my classes is that several classes use addEventListeners for complete events on loaders, tweens, etc. The question I have is, how do I catch those events in the event that the instantiated class object is removed from the swf file? Because the eventListener keeps listening, for some reason(I assume the object is removed from the stage but garbage collector doesn't get it right away).
My current, most prominent example is this:I have a photo album that utilizes php to import filepaths on the server. There are basically 2 stages: one screen where all the albums are displayed, and another screen where all the images for a given selected album are displayed.
The problem is that when you click one of the albums, it loads all the images from that album and THEN transitions to the viewing page. This is good because it doesn't load all the images from all the albums.
The problem is, it's possible for the user to click one album, and really quickly, before the "album" page fades out, click another album.
If I've managed to not twist your brain inside out with this poor explanation, you may see that the loader object for the previously clicked "album" button will still be loading the one of the previous images. So, when the complete event for the loader is fired, I get this:
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
Which I assume, obviously, is 2 separate error events. I'm already using error catching that's working for another purpose, but I just can't catch these ones no matter where I put my catch statements. Any help?
Here's the code:
Code:
function clickHandler(event:MouseEvent):void
{
//////some stuff here
////////preps album images for display
[code]....
The first type error gets caught. It loops back through and works fine when you only click one button at a time, but otherwise it freaks out. I just don't know where to put the catch statement so that it just shuts up...
Is there a good way to check if a variable has been passed into my flash movie?For example lets say I have an app that looks up some data based on location. And I allow for it to be added to the HTML tags, In Flash how to I say set a default location in case of there not being one in the HTML tags?
View 4 RepliesI'm making a typing game that focuses on developing typing speed and accuracy. In part of this game, the user has to type a given word in a certain amount of time. If the user types the whole word within the time limit, the timer stops and it results in 100% accuracy for that word. However, if the user does not type the word within the time limit, I want to compare the typed word to the given word and find out how many errors they made.
I found this to be a lot more complicated that I had expected it to be. Fore example, if a letter was accidentally skipped or an extra letter was added, it will make all following characters seem wrong, even though the user only made one mistake.
How do I go about comparing the two strings?
I want to use Flash Cookies (=Shared Object). However I want to make sure that IN ANY CASE no adobe setting window opens, regardless of it's settings. In other words, if the User trusts my Cookies, good. If he doesn't, dont even bother him with that window, and dont ask to allow more disk-space. Just go on. Is there a way to test, if I can write minimal data (<10KB), without the User noticing, in order to only write data, if yes. Again, I want to avoid any window popping up asking for Disk-Space, EVEN if the settings say "Ask".
View 6 RepliesHow can I check what a parent MovieClip's class is?I have a Terrain class that I only want to use a function when the parent movieclip is a specific class, so that the terrain object can be used by multiple classes, but only launch that specific function when the parent's class is "WorldBase". How can i detect this through the Terrain class?
View 1 Replies