ActionScript 2.0 :: Can't Access Clip._alpha Through A String Var

Jan 7, 2011

I was trying to make a menu for a game, (and I succeded, it works fine) when I noticed that if I store a clip name in a string var I can't I acess it's alpha with varName._alpha (?) or some other ways I tried.

Is there anything wrong in my code, or is there a way to do it that isn't the one I'm trying?

The way I'm doing it, I have a MovieClip for each screen, that in turn contains all the MovieClips and Buttons, etc, that each screen must contain. So sometimes I must specify the path to things with "_root.MovieClipName.thatThing._blah". Although I think this has nothing to do with my problem there, since the vars are all declared in the stage's timeline...

If you don't quite understand how the functions work, here's a call swapScreen function example: swapScreen("overlap", "OptionsScreen", "options");

If "swap", it removes the screen I'm in, and attaches another one in place. If "overlap" it overlaps the current screen with an overlaper screen (like opening the Options menu ingame). restoreScreen() restores to the previous screen that has been overlapped.


ActionScript Code:
function swapScreen(swapType:String, ID:String, screen:String):Void
{
if (swapType == "swap")
{

[Code].....

View 2 Replies


Similar Posts:


ActionScript 2.0 :: If _alpha >= 100 Do This, If _alpha <=0 Do This?

Feb 25, 2004

I have a movie clip (dnk) 7 (not key!)frames long, with 7 different objects (mc's) inside, named dnk0-dnk6.Then, on the mc (dnk) I have:

onClipEvent (enterFrame) {
strDnk = "dnk"+(_currentframe-1);
alpha = getProperty(strDnk, _alpha);[code]...

So, the idea is, to have this mc's (dnk0-dnk6) fading one after the other in a sequence. Which happens as it is supposed to, but what I am trying to do now, is reverse it. With no luck, as you can see from the top script .I was thinking about a solution in a way of telling when _alpha is below 0, than the _alpha would start to rise, until it reaches a hundred, then it would start to fall again.

View 2 Replies

Flex :: Access To Object Property When The Propety To Access To It's In A String Variable?

Oct 20, 2010

It's too complicate to explain but I'll give you an example

I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?

View 2 Replies

ActionScript 3.0 :: Access An Array Using A String As Its Name?

Aug 12, 2010

In AS2, you used to be able to access an array using a string variable by putting it in [].[code]...

Is there a way to do this in AS3 without having to create pointers and references?

View 3 Replies

ActionScript 3.0 :: Access MC Instance When We Have Only Its Name As A String?

Jun 8, 2009

I am sending the instance name (i.e. String)of the MovieClip to a function.From that function I need to access that same instance of MovieClip using that name.I have a MovieClip Instance name Planet_mc. And I am sending it to function abc()

abc(Planet_mc.name);
function abc(s:String):void
{

View 6 Replies

Use String Values To Access Movieclips?

Dec 24, 2010

I'm just wondering if it is possible to use a string values as a way to use the addEventlistener function.[code]...

View 5 Replies

ActionScript 2.0 :: Access Variable Name As String?

Jul 29, 2009

function fn1(var2)
{
//here i want to trace the name of var1....ie output: "var1"
}
fn1(var1);

how to trace the variable name i am passing to fn1 (ie. var1) as string?

ie. output shoud be

"var1"

ie i want to trace the name of argument variable i am passing

View 0 Replies

ActionScript 2.0 :: Access A Certain Digit In A String?

Jul 22, 2010

Is it possible to access a certain digit in a string? For example, if i currently had a value '321' then if i clicked on a button for example it changed the 2nd digit in the string to say 5...making it '352'.

This is probably really easy to do but im not sure how to do it!

View 5 Replies

ActionScript 3.0 :: Access Variable Via String?

Mar 11, 2009

Is there a way to access a variable via a String? Something like this:

HTML Code:
var myVar1:Int = 1
var myVar2:Int = "myVar1" as variable name

This is obviously doesn't work (and in this case pointless), but is there a way to do this?

View 4 Replies

ActionScript 3.0 :: Use A String To Access The Object?

Feb 28, 2012

How can i use a string to access the object instanced as : beef : on the stage.

View 2 Replies

ActionScript 2.0 :: [FMX]_alpha Crossfade Between 2 MC's ?

Apr 22, 2003

I have 2 movieClips that I want to fade.mc 1 fades out while mc2 fades in. I want to do it in AS to keep my file size down, 'cause I will be having quite a few of this happing.I know how to have one mc fade in using:(I know this is a fade in and I can fadein/out individually)

speed = 10;
bigCalendar_mc.onEnterFrame = function() {
if (this._alpha<100) {[code]......

View 4 Replies

ActionScript 2.0 :: CreateTextField And _alpha?

Jan 7, 2008

I'm not having luck setting alpha values with _parents that contain child textFields created dynamically. The text filed doesn't change its _alpha with the other objects in the movie clip.

View 3 Replies

ActionScript 2.0 :: _root.mc._alpha == 100?

Feb 13, 2004

I have this code. It works fine when i press a button.

if (_root.mc._alpha == 100) {
this.onEnterFrame = function() {
speed = 50;[code]....

I need to know how can I trace the _alpha value of the mc and when the value is 0 a movie clip is loading in the same mc.

View 3 Replies

Actionscript 3 :: Access Query String In Flash

Feb 22, 2010

In as2 it was very easy to access query string just using _root, but this doesn't seem to work on as3.[code]How do i access value of a? I tried it with _root as well as in flash client tried this userNameTextField.text=root.loaderInfo.parameters.a;But both doesn't seem to work. What can be the problem?

View 3 Replies

Xml :: Flex - Access The Value Of An Attribute Using A String Variable?

Aug 1, 2011

Using e4x in flex:

var attr : String = "foo";
var xml : XML =
<resultSet>
<node foo="1"/>
</resultSet>;

How can I use the variable "attr" to access

xml.node.@foo

I thought I could do it with

xml.node.@[attr]

But this doesn't seem to work. How can I access this attribute by a dynamic value like this?

Both

xml.node.@[attr];

and

xml.node.attribute(attr);

work, as Constantiner suggested.

Updates:

Say I have an XMLList in this form:

var bar:XML =
<resultSet>
<node>value</node>
</resultSet>;

I want to filter the original xml above by matching "foo" attributes with the "value" from node in bar.

Essentially I want a sublist of the original xml such that

xml.node.@foo == bar.value

for each xml row in the original value

As Constantiner mentioned, I can filter the original list by the value in foo, but what if I want to filter on multiple values?

Can I do something like:

xml.node.(bar.node.contains(attribute(foo)) ? attribute(foo) : null);

Or perhaps a cleaner method instead of the null?

View 1 Replies

ActionScript 3.0 :: Access A Query String In Flash?

Oct 27, 2009

Suppose There is one [url]...

I want to access the id="123" from the above URL.

Is there any way of doing it?

View 2 Replies

ActionScript 3.0 :: Access The Value Of A Variable Of Which Only Have The Name As String In A Function

Dec 29, 2009

my goal is to keep my output window organized so i can follow all my traces more easily. so i wrote a couple of custom functions to achieve that. one of them would be: to more easily trace the following variable for example

[Code]....

View 6 Replies

ActionScript 3.0 :: Access Parent String From Sub Class?

Jul 11, 2010

I have a Main class that has a public var "foo" which is a string. my subClass is a movi clip that has a text field called txt. I want to access the document variable from the sub class but get error 1119: Access of possibly undefined property foo through a reference with static type flash.displayisplayObjectContainer.[code]...

View 5 Replies

ActionScript 3.0 :: Access Instance By String Reference?

Sep 6, 2010

I have movie clip Ball what has public function glow[code]...

full access to Ball is MainMenu.ImagesPanel.Ball

I want to send command from server in text like:

string="MainMenu.ImagesPanel.Ball.glow"

How to convert sting to structure?

View 0 Replies

ActionScript 3.0 :: Access String Value Inside Of MovieClip?

Jun 10, 2011

Now one of the functionality that's added to the player is the "Transcript Button", which shows subtitles in a small window.Well, what I've done is added text on keyFrames of the main timeline,so if the audio says "Hello good evening, welcome,....", I've made a new layer above the audio layer and during that particular part of audio I've added the text on the new layer in a keyFrame.I've done this for the entire timeline.I've used enterFrame and accessed this String value and displayed it in the small window.Everything seems to work well.But if a certain movieClip popup is added on the timeLine, which has its own audio.o necessarily I'll have to add the text to this movieClip as well, but I cant access the text, i.e, display it in the small window.Also I've tried using a global variable like this,...

.as file
package
{

[code]......

View 0 Replies

ActionScript 2.0 :: Out Of Range _alpha Values?

Aug 3, 2010

Does setting _alpha levels to values less than 0 or greater than 100 cause problems?I know I can program these out but I am trying to make some code as efficient as possible.

View 9 Replies

ActionScript 2.0 :: Change The _alpha For A MovieClip?

Aug 20, 2010

I'm trying to do something fairly simple. I have a movieclip that when clicked with change it's alpha = 0.This is the script I'm using for the movie clip:

ActionScript Code:
onClipEvent (mouseUp) {
_alpha = 0;

[code].....

View 4 Replies

ActionScript 2.0 :: _alpha = 0 When Clicked Outside Movieclip?

Oct 30, 2006

how to have a MC have _alpha = 0 when clicked anywhere outside the mc

View 9 Replies

ActionScript 2.0 :: Increase _alpha To Certain Percent?

Jan 19, 2004

im using the current code on an mc to fade in

[AS]onClipEvent(load){
this._alpha = 0
fadespeed = 15;
}
onClipEvent(enterFrame){
_alpha += fadespeed;
} [/AS]

how can i make this increment until it reaches 75% instead of 100?

View 5 Replies

ActionScript 3.0 :: Create A Quick Access To An Object With A String ?

Sep 8, 2011

I'm trying to create a quick access to a object with a String as it's key, so I wrote:

"var map:Object = {};
map["key1"] = object1;
map["key2"] = object2;
..."

Is there any difference about the performance between long key and short key(the length of the String used as a key)? If the key contains many charactors, will it slow down when accessing that object?

View 3 Replies

Actionscript 3 :: Execute A String / Access Compiler In Time?

Apr 13, 2011

I'm developing a compiler generator in actionscript 3 with flash builder 4. I need to find a way to:

1.- Execute code inside of a string.

it could be very complex code, not just trace() functions but complete code

2.- Another alternative can be to tell to the actionscript compiler to compile the code autogenerated from my compiler generator.

View 2 Replies

ActionScript 1/2 :: _visible Doesn't Work But _alpha Does

Jan 5, 2010

I'm using AS2 (Flash 8), and I created a subclass of MovieClip - Card and attached an instance to the stage using attachMovie. However, I can't seem to make it invisible using _visible. Using _alpha works, however, but I would like to use _visible instead. where the problem might be? Here's the relevant code:

[Code]....

One more thing, what are the events for when the mouse cursor enters or leaves a MovieClip? I've tried onRollOver and onRollOut, but those are apparently not the correct events...

View 2 Replies

ActionScript 2.0 :: Embedded Dynamic Text _alpha?

Jan 13, 2009

I have created a movieClip and placed two dynamically created text fields within it. These fields use embedded fonts and work when I first add text and the format to themThe issue I'm having happens when I change the _alpha of the containing movieClip to 0. After that I can not get the text to appear again, even though the _alpha on the containing clip traces out to 100.I am not using the tween class on the textFields or containing clip to achieve the _alpha. I am however using the tween class elsewhere.

View 9 Replies

ActionScript 2.0 :: Custom _alpha Function Not Working (one Way)?

Jul 8, 2011

I'm trying to fade a piece of text that I'm loading via XML in and out (as well as moving it's location in and out).* The fade out part is working fine, and as long as I have a _alpha.100 command where I'm currently calling my "slidein" function (really the fade in function) it works fine. No idea why! I've tried about 100 different placements and I'm stumped.. It's very perplexing.*

ActionScript Code:
function loadXML(loaded) {
if (loaded) {

[code].....

View 2 Replies

ActionScript 2.0 :: (dynamic Text) How To _alpha And Mask

Apr 4, 2006

I have a dynamic text box and i want to mask it but its not working. i remember once someone was showing me something that had to be done to a dynamic text box to get _alpha effects on them and I wonder if its the same thing. Problem is, I don't know what that "thing" is.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved