ActionScript 2.0 :: Creating A New XML Variable Dynamically
Dec 19, 2006Is there a way to create a new XML object dynamically? i need to do this because i don't know how many xmls there will be.[code]
View 12 RepliesIs there a way to create a new XML object dynamically? i need to do this because i don't know how many xmls there will be.[code]
View 12 RepliesI'm a few days into learning flash AS3 and I'm stuck. So i have movie clip that is made up of smaller clips, and I want to change the opacity of one of the sub clips. Here's my code so far
//MOUSE OVER EVENTS FOR PORTFOLIO ENTRIES
function entryOver(evtObj:MouseEvent):void
{
[code].....
use a loop to create a set of variable names. The forums have figured out how to do this in AS2. This works in AS2...
PHP Code:
for(var x=0; x<3; x++) { this["var"+x] = x;}trace(var1); // 1trace(var2); // 2
I have an HTML button that I need to dynamically assign to an AS3 variable when clicked (in order to load an .mp3). I am using externalInterface.call to collect javascript variables - I am just unsure how to change these dynamically when a button is clicked.
View 2 RepliesI have 14 buttons, and each one declares a variable; example:
[code]...
On the next frame I have another 14 buttons, and on Release I want to create a new variable with the content of _root.competencia; example:
[code]...
Instead Flash tells me this: Left side of assignment operator must be variable or property.Its what Im trying to do possible? Hope somebody can help me, has been 2 days, and I cant understand what is going on, I have tried a lot of ways without positive results, I know I have a long way to go to learn actionscript, Im to new in this!
I'm getting really confused and trying to save myself alot of code, haven't been able to google a solution.On the timeline I need a set of variables for each number of TotalNumberas an example ill use the variable w
for (il = totalNumber; il > 0; il--){
var [w +il]:int = 100;
}
[code].....
how would I make Flash create a jpg or png file of what was currently on screen dynamically? I would like to know how to go about doing this and I'm sure it probably involves some other scripting language (PHP?) also.
View 21 RepliesI need to make new sprites on-the-fly within a for loop, and this code does not work:
Code:
for(var i:int = 0; i<5; i++) {
var this['menuBtn'+i] = new Sprite();
[code].....
My game is initialized by calling the newBall function below. Every 10 seconds a new ball is created to increase the difficulty by calling the same function. The function works and creates the new ball movie clip, however the previous ball object gets destroyed for some reason. I have an array called ballArr that is supposed to keep track of all of the ball movie clips. I thought that by concatenating the name of the instance with an incrementing number that it wouldn't overwrite the existing object... what am I doing wrong?
Code:
function newBall() {
var ballNum = ballArr.length + 1;
var ball = this.attachMovie("ball_mc", "i" + string(ballNum), 0, {
[code]....
I would like to be able to create and call an Array dynamically. So to pass a name through a function and create an array based on that name.Then to store values into sections in the array. I got the creating the array dynamically working, but I can't seem to store into it.
Code:
Sort = function (numOfVars,Name,toSort){
This works
_global[Name] = New Array(New Array (),New Array());
This does not work
_global[Name][i][c]= 3
This does not work
_global[Name + "[i][c]"]= 3
This does not work
_global[[Name][i][c]]= 3
}
I have two MCs classesThe first one is put on the stage. Then, from the first MC class (inside the class), i put another MC. So i created a MC inside the first MC.I can see both MC when i test my movie.I put the second MC when the mouse cursor is over the first MC, and i remove it when the mouse cursor is out the first MC.My problem is that when the mouse cursor is over the second MC, the movie behaves like the mouse cursor goes out of the first MC, so the second MC is removed, so i can't click on it.
View 2 RepliesVersion: Flash CS4, AS3 is it possible to turn a given sprite into a Class with a given string as its name? The resulting class should then be available under that name in the current domain's definitions.ie.
createClass(someSprite, "someName");
....
var someClass:Class = getDefinitionByName("someName") as
Class;
On library i have mc. In property i made Export for ActionScript. And on timeline add code:
var my_pic_mc:Pic=new Pic();
addChild.(my_pic_mc);
but dont see my movie clip on the stage after compile.
I have a XML and it has an attribute option or combo box, parsing that i need to create components in my flex dynamically. Viatropos has given a wonderful code, but i am not able to execute it... can anyone produce it.
View 2 Repliestake an arbitrary variable, and create that number of timers, with a corresponding number of listeners? And then write a function to deal with the listeners?
View 7 RepliesI want to make a site for my personal gallery and i'm asking you if there is another method to make my gallery, other that the one when the user click Back and Next to navigate through thhe images in the order that i chose. I want to create some buttons dynamically (so i will be able to add images to the gallery without replacing the SWF) and assign each of these buttons an on(release) or on(press) event handler that will show the image for that button
View 4 RepliesIm creating many textfields dynamically and I dont want to have to repeat the same code over and over for each field. Currently I have something like below which deosnt work.
Code:
labelFormat = new TextFormat();
labelFormat.font = "Verdana";
labelFormat.size = 5;[code].....
I'm using Flash CS3, Actionscript 2.0 and I'm trying to create buttons dynamically.I tried to follow the code in the link below. The code is correct for the most part but the only problem I have is that only the last button appears. For example, if I try to create 10 buttons, only the 10th button is created.
View 6 RepliesI've been trying to create a scrollpane dynamically but I keep getting a bunch of errors when I publish the swf. At first I thought maybe there was a problem with my code so then I looked in the file and copied and pasted one of there examples into a blank fla and I still get the same errors when I publish. If I look at what is the source of the errors it looks like the error originates at this section of the ScrollPane.as file:
Code:
override protected function drawBackground():void {
var bg:DisplayObject = background;
[code].....
how would i go about dynamically making a function... im making a Tile Based World level editor and when the user is done editing a level, then they hit a button and a couple of for loops runs through all the tiles checking the x,y and tile type. then i want thisinformation to be parameters within sub functions within the main function. so the as would look something like this
[AS]subFunction = function () {
//do this
}
[code].....
I'm creating buttons dynamically, but I want to add code also. something like (psuedo)[thumb + i].on Release = "_parent.thumb" + i + "Pressed()" can that work? I think I need targetMc?
View 3 RepliesI need to create a circle dynamically in as 2.0, i.e., when i drag the mouse downwards the circle should get bigger and when i drag the mouse upwards the circle should reduce smaller according to the radius of the circle it should resize.
View 1 RepliesAre there any built in utilities for playing/creating MIDI style music in AS3?I'm not looking for something that will play .mid files, but something that will be able to play a "Middle C " tone, either as a piano tone, or as a cheap computer tone.
View 1 RepliesSo I have this loop generating buttons based upon how many entries there are in my XML:
Code:
for (j=0; j < base.image.length(); j++) {
trace(j);
var newButton:imgButton = new imgButton();
[Code]....
Now I'm just wondering what the best way of assigning control to the buttons is (i.e. making them do something,). I'm wanting each created button to load a different image (defined in the xml) if that's of any use.
Do I need to add event listeners dynamically or something?
Is there any way to create dynamic animations? Say if I'm creating a game and there might be multiple sprite sheets for different NPC's, would I have to manually create the walking/whatever other animations manually?
View 5 RepliesI'm currently working on a project where I need to create a grid of dynamic text boxes each displaying my specified number. I won't go into big specifics, since I can assign the values to each text box, but for some reason I'm having problems creating the grid dynamically. I've used the same method for attaching Movie Clips in a grid, and it works fine, so I can't figure out for the life of me what the problem is.
[Code]...
I want to make a site for my personal gallery and i'm asking you if there is another method to make my gallery, other that the one when the user click Back and Next to navigate through thhe images in the order that i chose. I want to create some buttons dynamically (so i will be able to add images to the gallery without replacing the SWF) and assign each of these buttons an on(release) or on(press) event handler
View 4 RepliesI have an app that lets you upload a photo and mask part of it. I want now to press a button that takes a screengrab of the flash player and saves it to the server.I'm aware this will require scripting to talk to the server but for the flash part of taking a I've even considered using fscommand to somehow access the printscreen function but don't think this will work after checking the documentation.
View 10 RepliesI'm creating a mask in what can best be described as a glorified spotlight effect program. It involves dynamically creating a gradient circle that will be the spotlight in question. However, I've run into a problem while creating gradient circles dynamically.
Code:
// in CS4
var testCircle:Sprite = new Sprite();
testCircle.cacheAsBitmap = true; // this can be true or false; doesn't fix the problem
[code]....
However, no matter what you put as CIRCLE_RADIUS, this will always output an approx 100-radius gradient in the center, and whatever is left over will have 0.0 alpha the rest of the way.So if you make one with a radius of 300, it'll show up as a circle with radius 100 and 200 pixels either side of blank space.Intersetingly enough, if you set the radius to less than 100 (say, 80), it'll cut off the circle at the radius and leave you with a hard edge.
I've found that if you set the ending alpha to anything other than 0.0, the full gradient is rendered. But I don't really want a hard edge Of course, fancy matrix transformations can fix this. But even those are unpredictable for some strange reason...even an identity matrix scales it drastically.Or do I have to go with pre-rendered ones or fancy matrixwork?
I'm creating / adapting a horizontally XML dynamically loaded menu. Load the text for each menu item from XML, and then I place this text in an array. Then later in my script I run loop through the array to add the menu items / text to the menu.I want the horizontal menu just to be a line of text so like:Menu item | Menu item two | Menu Item threeEach one gets put in a dynamic text box. I want to find out what the width of menu item one is so I can set the x position of the next menu item.I was thinking I could as I loop through and create each menu item, add the widths (using TextField.textWidth property) to an array and then use info in there to set the x position of the next menu item.
View 1 Replies