ActionScript 2.0 :: Using _global For New Sound?
Feb 20, 2006is that a bad thing? or does it not matter? sorry if i missed a post where this has already been cleared up eg..
[Code]....
is that a bad thing? or does it not matter? sorry if i missed a post where this has already been cleared up eg..
[Code]....
I have my setInterval that is set this way:
[Code]...
I was wondering how I might change this to a "local" function instead of "_global". I've been trying, but my syntax is either screwed up or just just plain doesn't work.
i want to get a value of _global.id var outside the function. Here is the code
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = loadXML;[code]....
when i trace _global.id out of function it is undefined, and when i trace it in the function it gives 1, which is ok. How can i get that value out from function?
orrect the syntax of my code:Code:firstOne = _root.content.content_group+_global.whichOne;I have 3 movieclips called content_group1, content_group2, etc. I have a button that calls this: _global.whichOne = "1";Now, how can I correct that code above so I get content_groupX?
View 3 RepliesI am using _global to declare my vars and funcs. On the whole it makes things easy for me. However, I have come up against something that I cant fix.
Code:
_global.swipeCount = function() {
if (c >= 3) {
text01_mc._visible = 0;
text02_mc._visible = 1;
[code]....
This function is called from some MCs that have a simple single-layer, timeline-tween with an action at the last frame calling this function. The problem is that _root.swipe_mc.stop(); never executes. The MC keeps playing. I can however make it _visible = false; So it is finding the correct path.
difference between _root and _global when dealing with variables or point me in the direction of a good explaniation on the web? I feel like there is something basic I am missing. For example the other day I was working on making some scenarios. In a nut shell I was setting up dynamic text boxes where the text would changed based on what the student selected (via buttons).
When the varible was changed (by clicking the button) the text wouldn't refresh when it was a _global, but would refresh when it was _root. Everything is working fine but I've been trying to understand the "why" it works this way.
I recently read an article about prefacing your variable w/ _global.
And I think it rocks!!!
Why is this practice taboo?
Why do so many tutorials insist you remember the scope of every movie clip?
It seems to me that memory space is memory space.
I have a button with a list of _global settings:
_global.practiceName = pName.text;
_global.practiceStreet = pStreet.text;
_global.practiceCity = pCity.text;[code]....
Then I have a MC with a dynamic text box with some AS:
practiceInfo.text = practiceName+' - '+practiceStreet+", "+practiceCity+", "+practiceState+" "+practiceZip+" - "+practicePhone+" - "+practiceSite;
The problem I am having is it ONLY inserts the FIRST _global property! Only the pName.text goes in. Am I missing something here?The practiceInfo.text works great if I manually state:
practiceName = "AbC";
practiceStreet = "1235 Way";
I have a swf page where the external swf will load, there is any way to declare variables who work in all swf. What I am trying to do is: like a switch, with several options in which all these are listed in the main swf
View 9 RepliesThis is plain and simple, why is it not working? BUTTON
[Code]...
I have this code in an mc.
//////
function musikstil(a,b){
a.onRollOver = function(){
[code]......
through out a very old complicated fla there are buttons which set variables using _global paths
such as:
function menu1_2(Event:MouseEvent) {
global.mode = "hide_hotbox";
MovieClip(this).gotoAndStop("stage_1_b");
}
How can I make the variable "hide_hotbox" and others like it accessible and changeable from any movie clip -- whether they be nested in other movie clips or on the main timeline, etc?
how do you detect change in a _global variable?
This following is the code I am using which watches for change. (only the local variable)
ActionScript Code:
// Declaring the variable
myVar = "AtoF";
// Callback that will be triggered every time there is a change
[Code]....
I use _global to declare the global variable and its not working with this code.
I'm getting frustrating Why in Gods name this example doesn work???kirupa2 loads kirupa1 in which is _gloal variable setup (_global._myVariable = "XYZ")After clicking on PLAY button trace outcome is undefined
View 6 RepliesI have Flash site with different .swf's.
[Code]....
In projector.swf I have a movieClip with 2 buttons for language: nl_btn & eng_btn. Clicking makes the _global.taal change to "dutch" or "english". menu.swf gets the global and responds, but all the movies loaded in _level0.container_mc won't get the globals set by projector.swf. Now that menu.swf is in as1 i thought this would be the problem, but changing the _level0.container_mc movies into as1 I still couldn's trace the _globals.
i am loading in a movie clip from a location online. that much works fine, however, in this external movieclip, it is making a _global function call to some code i have in my main swf which this clip is being loaded into.
[Code]...
I need to pass the value of a attribute to a _global variable that can be accessed somewhere else in the movie.But it traces as undefined outside of onLoad.
eg.FRAME ONE
ActionScript Code:
var xml:XML = new XML();
xml.ignoreWhite = true;
[Code].....
I have recently started making (and am still making) the transition from ActionScript 2 to 3. I have used the _global variable in an AS2 project as I needed a variable to be accessible from within ANY swf loaded into my main movie. This worked like a treat.
However, along came AS3 and whipped that from right under my feet. After much Googling, a few people suggested making use of a simple class with a simple variable that can be publicly set and retrieved. I made a simple class, imported it and manipulated the value, and all went well, however the instance of the class I create in my main loader movie is still not accessible from within a second SWF that gets loaded into my movie. If I re-instantiate the class in the SWF that is being dynamically loaded, the value reverts to the default value in the class code, not the new value set in my parent (first) movie.
Here is my class code, stored in an external .as file, is there any way I can simulate the ostype variable being a global variable?
package{
public class ostype {
public var ismac:Boolean = false;
[code]....
it's used as a simple identifier as to what operating system this flash app is being used on (mac or windows) and as a result let's me server content - such as saving files - in a different manner.
Is there a way to stop every nested mc animations as once. In other words, I would like to stop every existing playhead in my swf file with one button. Currently, I got on button stopping the main scene playhead, but it doesn't stop any nested mc animation.Here is what i got on my main scene action layer :
ActionScript Code:
_global.drapeau="1";
_global.stopPlay="play";
[code]......
I recently read an article about prefacing your variable w/ _global. And I think it rocks!hy is this practice taboo?Why do so many tutorials insist you remember the scope of every movie clip?It seems to me that memory space is memory space
View 2 RepliesIs there or is there not possible to access _global variables between domains? on [URL] i have index.html and index.swf. Index.swf then loads main.swf from [URL].In index.swf i have a _global variable that i want main to use. When calling for it all i get is undefined. The only way to access it is if i call for it using _parent or _root.
I have allowed the domains to communicate using
System.security.allowDomain("http://www.Domain1.com");
System.security.allowDomain("http://www.Domain2.com");
I have also put a crossdomain policy file on both servers..cross domain policys since i CAN access the variables and functions using _parent and _root...or is it?
I can't understand this stuff. A global variable is a variable I can read from anywhere in the document right? if I make a mc and in the action frame I type:
_global.myVar=5;
After that in the action frame of the main timeline I try to trace the variable with this sentence:
trace (_global.myVar);
and I get this error 1120: Access of undefined property _global.It's just me or the help menu or live doc are really useless?The examples I found are not working. The definitions are not really clear etc etc
Here's some background: I am working on a project in which we have one main Flash file that loads other Flash swfs into an empty movie clip within the main file.The main file instantiates a class I've made (stateManager) into a _global variable.This object keeps track of the most recent states of the other individual files so users can navigate between them all and come back to the same status they left it.Here's the issue:In the sub files, I need to access the _global object, which was created in the main file, many times so I would like to use the 'with' construct to reduce typing. However, because the 'with' statement needs an object to reference, I am unable to publish my files .I've tried adding an if-statement at the top of each file (if(_global. stateManager == undefined){ ), but this doesn't work either.I've included a portion of my code for you.
Code:
import classes.stateManager;
if (_global.stateManager==null) {
_global.stateManager = new classes.stateManager("./InitFiles/global.xml");[code]....
I am making a jigzaw and when all the pieces are put in the right place, another movie clip will be played.All pieces are buttons placed in different movieclips. The movieclips are then placed in scene 1.
In frame 1, I've written
_global.var1=0;
In frame 2, I've put movieclip1, and in movieclip1 I've placed button1, with the following actionscript:
on (press) {
startDrag ("_root.movieclip1");
}[code]..........
However, when the piece is in the right place, and the if-statement has been activated, _global.var1 is still 0 when I trace it in frame2.
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play. I have set it for any silence before the actual sound by calling the sound like so:
[Code]...
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
I loaded and then trace my _global variables for three screens and they follow me fine until,. then on the the screen i have tiny bit of code:
[Code]...
Could it be the level 99 I use. I tried using 0 and it did not work? I have tried doing this for way too long,
According to the Flash 8 Actionscript Bible, it is possible to set a style that will affect all instances of a certain component class by typing the following code:
ActionScript Code:
import mx.controls.*;
import mx.styles.CSSStyleDeclaration;
_global.styles.componentClassName = new CSSStyleDeclaration();
_global.styles.componentClassName.setStyle("styleAttribute", "value");
A disclaimer says that "[this style technique] will work with almost all of the component classes. However, the following classes will not allow you to set a class style object: List, DataGrid, Tree, and Menu." (ch 29, pg 644)
So why does the following do nothing:
_global.styles.Label = new CSSStyleDeclaration();
_global.styles.Label.setStyle("autoSize", "true");
I have a flash header that was never completed because the guy I hired took people's money and ran. So now I even wonder if what he said could work with my flash header is true or not. But, usually there is always a way to make it work.
I have a flash header that does two important things: 1) Upon entering the site, it loads and plays an audio track 2) Makes an animal noise when you hover over each animal menu item. (not sure if I'm able to give a link to it or not on here. If I able to and someone would like to see it let me know)
I want to know if my flash header can support the following additional functionality/changes:
1) Currently, it loads everytime a page is selected. I only want it to load the one time of entering the site because the audio gets annoying. Set a cookie maybe?
2) But, I do not want to turn the audio off completely because I still want the hover over each menu item sound.
3) Have a link on it to allow them to select to turn on / off the sound completely. It currently has that, but only for the current page. Once you select another page, the audio is back to on.
4) Lastlly, is there a way for it to detect that someone doesn't support flash and to display an html version of it? And can flash create a html version from my fla file?
I don't know much about flash (but am learning) so I'm not sure if I'll be able to do this myself. However, I want to find out if my flash header will even work this way before I invest the time learning it just for these changes. I know it will be pretty deep with script code, but I'm hoping I could find base code already available for these features. Not sure I can afford help now because of being laid off and two different scammers taking advantage of me. So I'm going to try to do myself and see if there is any suggestions/support on here that can help. I have Flash CS4.
I have several buttons in a movie and I want to be able to rollover an individual button and play the sound for that button and when I rolloff I want the sound for that button to stop.
View 6 RepliesIs there any AS3 library or code-snippet that can create altered versions of a Sound object on-the-fly (at runtime)? Either based on:
An existing Sound object; A ByteArray object;
For example, say you have a "dry" sound of a gun-shot. You could:
[Code]...