Actionscript 3 :: Concatenate E4X Expressions If Store "half" A Path In A Variable?
Apr 27, 2010Is there any way to concatenate E4X expressions? If I store "half" a path in a variable, can I concatenate the way I do with Strings?
View 3 RepliesIs there any way to concatenate E4X expressions? If I store "half" a path in a variable, can I concatenate the way I do with Strings?
View 3 RepliesI'm trying to achieve something i thought would be extremely easy, but i can't get it to work!
[Code]...
I want to move a mc with actionscript, along a path, and this movement to last about half or so of a second (just like tweening in the timeline with frames and all). How can i do this?
View 2 RepliesHow do I concatenate variable names in AS3?Something like this:
for(var i:int=0 ; i<5 ; i++) {
var "myVar"+i:Array = new Array();
}
I'm starting out with AS3 and migrating some old code. I have several dynamic variables in AS2 but they are using _root which isnt available in AS3.How would I go about switching the following variable to AS3? I have at least a dozen different variables similar to this one.
Code:
for (i = 0; i < (k-1); i++) {
pivot = _root["AI"+i][i][i]; // existing AS2 code
[code]......
I'm trying to concatenate a name and variable number. Then trace it, so answer3 should output from my loaded xml data "water". Instead all I can get to trace is the word "answer3". If I type "answer3" in the trace I get the variable im looking for. If I type [this.getCorrectAnswerNumber()] in the trace I get number 3. How do I go about concatinating the word answer and a dynamic number.
Heres my code...
Code:
trace("answer"+[this.getCorrectAnswerNumber()]);
Here's what i'm trying to do: Hide a MC depending on the path variable as:
[Code]...
Well that doesn't work, for some reason, i can't use a string as a multiple level path..
So I can create a circle and an oval using trig in flash. But what if I want to create an oval with rounder points? I'm using this code for circles and ovals:[code]Could anyone help me in editing the code so i can control the tips of the oval and make them rounder?
View 9 RepliesI have a movieclip with an image fading in and out (using an actionscript tween class set to yoyo). This movieclip is loaded into a dummy movieclip when a button is pressed. The first time you click the button the fading movieclip plays as it should, fading in and out continuously. However, the second or subsequent times the button is clicked the fading movieclip goes crazy, half fading in/out and half jumping from one alpha value to another.
View 7 RepliesBuilding a flash website in CS3. I've made every button the exact same way, draw a rectangle, convert to symbol, type as either button or movie clip (doesn't seem to matter and I'm not using rollover stuff), alpha 0% and stick it on its own layer above everything else.Action scrip is as follows:
main1.addEventListener(MouseEvent.CLICK, gotoMain);
main2.addEventListener(MouseEvent.CLICK, gotoMain);
function gotoMain(event:MouseEvent):void
{
gotoAndPlay(1);
}
that's with 2 buttons for main. I have the exact same code multiple times for many different buttons. It works everywhere except the last two buttons on my page will work the first time you click them from the main page, but then don't work after that until you click on the main page again. Then it works.These two:
babout3.addEventListener(MouseEvent.CLICK, gotoAboutb1);
bcontact3.addEventListener(MouseEvent.CLICK, gotoBcontact1);
the function is described on an earlier action keyframe:
bcontact1.addEventListener(MouseEvent.CLICK, gotoBcontact1);
function gotoBcontact1(event:MouseEvent):void[code]...
Of course I've tried just having one button do this and copy/pasting the button on different areas of the movie, but nothing I've done fixes. I've even gone through and deleted every button and AS and redone it. I've put every button on its own layer (shouldn't matter but I'm trying everything I can think of).if there is an easier way of using AS to navigate a flash movie let me know. The other options I've seen seem a bit too complex at the moment.
The first half of the tween doesn't work but the second half does. It only does this when I add the code link._visible = 0;. This is to make the alpha completly disappear.
View 1 RepliesI would like to store a hex colorPicker value in a variable and then cast the value of the var backout to a textInput. The textInput is just to see witch hexcolor i have choosen.
thus meaning seeing 0x000000 in the textInput.
what i've done now is pretty simple i have bound the flex colorPicker directly to my textInput. but i want to store the value from the colorPicker in a var first and than spit it backout to the textInput to see the value that i have picked.
When i pick a color value that begins with the number 0 it drops the 0's at the beginning of the number and only spits out the numbers greater than 0. (000033 becomes 33, FF0000 stays FF0000). I want to catch the whole value or write some kind a function to figure out how many 0's got dropped and concatenate it together with 0x. Store that all into a var and bind it to the flex TextInput.
This is what i've got.
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
[Code].....
I'm getting back into AS after a few years, and it's taking a bit to get used to the syntax of AS 3.0.
Anyway, I don't know the answer to the following in AS 2.0, so I wonder if it's even possible.
Basically, I want to know if there is a way to call a variable, the name of which is stored in another variable.
How would I write something like "NextToDisappear.alpha = 0;" and have it interpreted as "MC4.alpha = 0" instead of giving an error message complaining that variables don't have alpha properties?
In other words, is there a way to make it interpret a variable as its contents and not as itself when on the left side of an equals sign? Similar to the difference between quotes and no quotes when working with the contents of text variables.
I want to store the name of an xml node in a static var like so:[code]but when then i go and wrtie for example:myxmlList:XMLList = myXml.NODENAME;it is non working.what kind of variable do I need to use??
View 2 RepliesIs it possible to store multiple variables of different types inside 1 object. It would be ideal to have a separate property for each variable, but not required. Is there a way to do this?
View 2 RepliesCode:
for (var i:Number = 0; i<numOfItems; i++) {
var t:MovieClip = "item"+i;
t.onRelease = activator;
}
This returns an error saying that there is a type mismatch because "item"+i is a string. It is a string, but it's also the instance name of an MC on the stage.
Let's say I have 30 MC's on the stage named item1, item2, item3, etc. Instead of assigning an onRelease statement to each of these manually I thought I could just run them through a for loop. They are not dynamic clips though, not at this point anyway.
i also has another problem here is the senario .first i select the square (there are too many object one of is square )then click the button now my event target is button previous one is square so i need to change the square(object) using that button.
View 10 RepliesI have a AS2 netstream instance, in which I am loading various flv's into. The 'main' video has links to other visble when its playing. I want to be able to store the position of the flv (in seconds) so that when the user comes back to the 'main' video it remembers where it was and contiues to play. This is the code I have written so far regarding this (its probably massively wrong).
var remember:Number;
if(ns.play == ("flvs/reel.flv")) { ns.time = remember; trace ("stored"); }
[code]....
I am new to ActionScript 3.0, I am facing a problem in storing the data from one frame to another whenever the button is clicked to switch between the frames. The original frame content is set to default.
View 1 RepliesThe fill function that I made works as long as you only need one color. How do I make a variable that will store the color? flash keeps giving me an error for trying to do it the way I am doing it.
Code:
fillit = function (d, e, f, g, color) {
color2 = "0x"+color
_root.lineStyle(1, 0x666666)
[Code]...
I have a variable (array) in my ActionScript 2 file, called webshop.Is this possible to store in a cookie (or PHP session) so if a user visit my shop and add items to the basket (the variable webshop) and leaves the page, but then returns later on it will create the variable with the users already stored items?I think it would be most intuitive if it only stores the variable for the browser session, so if you close the browser and open it again it will reset the variable. But if you just leave the page it should save it.
View 1 RepliesI'am working with Adobe AIR application and i have a registration form which contains a combobox which consist of 2 values...i want to store the selected value to a variable..
[Code]....
exactly as the title says, or is there a way to call up its original x,y coordinates like box_MC.originalX or something?
View 5 RepliesI ve a bit of missunderstood about functions: as i read the functions works:
basically 2 types:
named (can be lonely)
unamed (need and object)
- can i define a function wherever i want? ( _root, MC...) and call it from everywhere?, before or after i created it?
- if the variables of a function are local variables of that function. How can i store the result of a calculation of the function, in a variable outside it?
im creating 100 movie clips through duplicate movie and assigning each MC an instance name of eh_1, eh_2, eh_3 etc... on rollover i would like to have have them store in a variable which button number they are.to detect rollovers and presses, im just using
Code:
for (i=1; i<101; i++) {
_root["eh_"+i].onRollOver = function () {
};
}
is there anyway i can detect which button was pressed and store into a variable the number?
I was wondering how to store a DATE value, selected from the DATEFIELD component into a variable.I.e. so that the user will enter a date (Sept. 12, 2005), and on subsequent frame, that date will be written as text. Thus, how can I store a selected date into a variable?
View 1 RepliesI am having problem to recall the copied bitmap data to show on another private function which is difference from the private function which copy the bitmap process. I am new in AS3 so have no idea how do I make the copied bitmap data into a global variable..
Heres my snippet of code:-
private function export():void {
var bmd:BitmapData = new BitmapData(216.2, 468.29);
var a_matrix : Matrix = new Matrix() ;
a_matrix.translate(-242,-130);
bmd.draw(stage,a_matrix);
[Code] .....
This is the problem I am facing, I need to separate the copying process and showing process because I want my flash to show the copied image later on...
i would like to know if it is possible to have a letter that is made up of multiple colors. for example above you will see a hebrew letter. the DOT underneath it is actually part of the letter, but it is a different color.is it possible to have this same functionality in flash? what i would need to do is upload an XML file with all the words, and i would need all the dots below the letters to be a different color
View 2 RepliesI have several UIs and wish to automatically load images into the containers. I have repeated the actionscript line, which has created a lot of code.As the lines are similar all but the image number, I am thinking to use a loop and variable to insert the image number into the code. Here is the code:[code]a variable to replace the number between I am not sure how to do the same for the Movie Clip path.Is it possible to use a variable to define the number (2) in this statement?
View 2 Replieswhy I cannot use a variable in a path?
Code:
function buttonControl(buttonNumber){
var buttonClip = eval ("bu"+buttonNumber+"_mc");
this.target_mc.buttonClip.gotoAndStop("active");
}
I can work my way around it, but why doesn't it work?