ActionScript 3.0 :: Adding A Dynamic Number To A Instance Name?

Jan 11, 2010

My name is Bryan i am 17 years old and i'm from the Netherlands. As i am trying to become a web design and developer i decided flash was a MUST to know, so i started trying flash and messing about. Now i'm trying to get into Action script 3.0 deeper. Currently i am trying to fix an externaly (XML) loaded image gallery for my self, except i'm a little stuck right now.Up to now all my code has worked. I've got 3 UILoaders set up for 2 jobs: Loading thumbnails (2 of them) and the other is for loading a 'full' version. I got that working. Except if i get huge images like a wallpaper etc. it screws up the size, so i set scaleContent to true.

- Set all the images dynamicly, with that i mean it loops trough all the thumbnails and gets the first 2, it dumps them into the UILoader wich is already the part i am failing at XD

- Check for the width and the height of the image (wich i either will include in the XML document or can i use something like: XMLData.image[ *number here* ].img_thumb.width (as a example)?

- Check if these are less than the UILoader's size and if they are less dissable scale content, if they are more enable it

So as i said im already failing at trying to dump the images in the thumbnails.I've got the following setup:

Root document has a MC: mc_content.
Inside mc_content we have: loader_image (full size of the image loader)
loader_thumb1 and loader_thumb2.

So what i want:

- Load the XML (works)
- Set some limits using variables (works)
- Start a for loop (works)
- get the thumbnail for the current image number (wich is a variable set and maintained in the for loop) (works)
- load the image into the loader_thumb *insert current image number here* (fails)

here is my current XML function:

ActionScript Code:
// Function that is called upon loaded complete
function xmlLoaded(event:Event):void{
// get the XML Data from the file

[code]....

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Dynamic Buttons - Adding The Specific Frame Number Every Time?

Dec 6, 2010

The buttons are used to jump to a specific (root-)frame (based on a variable); they're all nested inside a moviclip, each on its own layer, and for every frame there's one button more showing (imagine a staircase). Now, is there a way for a script that works for all buttons without adding the specific frame number every time? I started working with

ActionScript Code: on (release) {_root.gotoAndStop(_root.VAR+3);} where VAR also defines, how many buttons are shown (eg. frame number of the button-MC). +3 is just for the frame number on root. That way, of course, all buttons eventually lead to the same frame, or more precise: only the last button shown will lead to the correct frame.

View 4 Replies

Actionscript 3 :: Constructor To Assign Instance Name From Super Constant When Adding Instance In Flash IDE?

Jun 17, 2010

I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?

package
{
import flash.display.MovieClip;[code].....

The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.

View 1 Replies

ActionScript 2.0 :: Get Number From Instance Name?

Jun 14, 2010

I am really not sure what to call this problem / search for to view an old solution. So if I am being redundant, simply link me to an old thread / lock this.[code]...

View 2 Replies

ActionScript 3.0 :: Dynamic Hit Testing Against Dynamic Instance Names?

Jun 22, 2010

Ok, Background. I have two objects both of which im spawining in though code. We will call them bullets and wolves. They have their own .AS files which tells them everything they need to know about themselves. I figured i would do most of the hit testing on the bullet.AS file, hit testing against the wolves as there were going to be a set number of wolves but not a set number of bullets.o, I named them by running a loop and putting the linenewWolf.name = i.toString();Yes, new wolf is a declared variable, and i is the name of the variable that makes the loop run. I also have a test in it, and it works fine.

However, The hit testing is where i come into an issue. Remember, its on a seperate .AS file. The wolf maker and namer is on the main flash page.The hit testing function isif(this.hitTestObject(a)){i changed up my variable name to run a second loop. first variable name is "i" and the second variable name is "a"And for some reason i get a type error 1034, which from what i understand is an error that you get when two instance names are the same. Also, If possible, i would like to add letters to the name of the object, but im not sure if flash will let me as i belive the code would look something like this

View 1 Replies

ActionScript 3.0 :: Adding A New Instance Of A Movieclip?

Feb 3, 2010

I want to add a new instance of a MovieClip named chair_mc in my .as file but am not sure where to place it. I also want to bring in two other MovieClip symbols but am not sure where to place this. This is the code:
 
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code].....

View 18 Replies

Professional :: Instance Name When Adding From Library?

Nov 11, 2010

When addressing nested movieclips like so: _root.movieclip.movieclip.variable they need to have an instance name set, otherwise they count as undefined. So I can set that in the properties no problem, but when deleting it from the stage and then readding (manually or by actionscript) the instance name is gone thus I can not address nested clips by action script.
 
I don't understand how this will work then, since every time I add a clip by code it will have no instance name. The only alternative for me so far was keeping the clip on the stage the whole time, just out of bounds or invisible so I can still do stuff like _root.movieclip.movieclip.variable or _root.movieclip.movieclip.gotoAndStop(2).

View 8 Replies

ActionScript 3.0 :: Adding Movieclip Into An Instance?

Sep 10, 2009

i have a preexisting instance known as gamelevel. When the screen scrolls, gamelevel.x is modified. When the player shoots a projectile, this projectile is not moved along with the screen, because it is simply added using the addChild. How can i add the movieclip, but have it contained within the gamelevel instance?

View 1 Replies

Actionscript 3.0 :: Adding A MovieClip To An Instance?

Nov 23, 2009

I'm trying to place a MovieClip instance inside another instance on the stage, but flash keep shouting a good old error message at me, that being...

Code: Select all1061: Call to a possibly undefined method addChild through a reference with static type

Were as if I add it to the stage by itself, and not within another instance it works just fine? Here is my code...

Code: Select allpackage com.essenweb.projects
{
import com.essenweb.display.*;[code]...........

View 2 Replies

ActionScript 2.0 :: Adding Array Value To Instance Name

Jul 11, 2007

I want to loop through an array and call the same method for each button instance. So instead of hardcoding this:[code]

View 5 Replies

IDE :: Adding Same Instance Of The Object To Stage Twice?

Nov 30, 2009

I`m having a silly problem with adding instance of an object to the stage two or more times. For example, this don`t work:

Code:
var temp0:SomeClass = new SomeClass();
this.addChild(temp0);
this.addChild(temp0);

Well, I know that one instance is one instance and two objects of the same class on the stage would be two instances, but still, it is what I need.

View 1 Replies

Change Frame Number Of Graphic Instance?

Nov 19, 2005

I'm stuck on this annoying bug of Flash:to animate a character i have different graphic symbols of hand positions inside a single container graphic symbol; that way instead of having to swap different symbols while animating and tweening, i just have to change the number on the "single frame" input box on the properties of the symbol.

It worked fine a few sessions ago, but now it won't let me change the frame number if there's a tween before that keyframe; tha keyframe isn't participating on any tween, and may even have some frames between the previous tweening one. The only way it will change is if i remove the first tween or add a blank keyframe between them, wich of course isn't an option when animating... i know it would work if i add a new layer and continue there, but it'll add a lot of mess to the already busy timeline.

The strange thing is that it remains working on some frames, from the previous session, and if a cut and paste them i can change the frame number freely; but if i try to build a secuence from scratch, it won't let me, even on a new document.

View 2 Replies

ActionScript 2.0 :: Adding The Digits In A Number?

Jan 22, 2011

I have a variable called "myNumber"

myNumber = 1382;

As you can see it equals a number, (This number is subject to change throughout the project.How can I add all of the digits in this number up into a new variable.The number is "1382" so the new number would be all the digits added together... 1+3+8+2, "14"

View 5 Replies

ActionScript 2.0 :: Adding With A Number Array?

Nov 15, 2004

I have an array, strictly numbers, how could I add... say array[0](value=2)+array[1](value=1) to equal 3? What I come up with is an undefined error, or not a number...

View 3 Replies

ActionScript 3.0 :: Adding Instance Of Symbol To Stage?

Jul 29, 2009

I know this is one of the most basic things, but I am having trouble adding an instance of a symbol to the stage with action script in Flash CS4. I have a "fireball" symbol and at the beginning of my code I say:
var myFireball:MovieClip = new fireball;
addChild(myFireball);
But it says : "1180: Call to a possibly undefined method fireball."

View 1 Replies

ActionScript 3.0 :: Dynamically Adding Instance Names?

Mar 31, 2011

Is it possible to add a textField dynamically but have different instance name each time this is created? In other words if I have a button that whenever its click it will add a textField to the stage and assigns a new instance each time this is added.

Code:
button.addEventListener(MouseEvent.CLICK, addField);
var inputWidth = 200;
var inputHeight = 20;

[Code]....

View 10 Replies

ActionScript 1/2 :: Set A ComboBox Instance To A Certain Value (without Knowing Index Number)?

May 17, 2010

I have a ComboBox, with it prepopulated with the States.When I have a variable that says it should be pre-selected to for example CA, how do I do that, without haveing to figure out the index number for every single state?

View 3 Replies

ActionScript 3.0 :: Adding And Subtracting From A Number Within A Text Box?

Jan 27, 2011

I imagine this to be a simple question, but I don't seem to be able to figure it out being knee deep in code !!I have this variable :-var blackCredit = creditBlack.text;When I try to add or subtract 1 from the amount in the text box, like this :-blackCredit += 1;and then update the text box with the new value :-creditBlack.text = blackCredit;It's adding the 1 to the end. i.e. 16 becomes 161, instead of 17..

View 2 Replies

ActionScript 3.0 :: Adding Child At Certain Frame Number?

Jan 25, 2009

I want to addChild at certain frame say 130. And I used the following format

var btn1:Button = new Button();
gotoAndPlay(1);
addings();

[Code].....

put and even I can't get the trace result. how to add childs at any frame number I want

View 3 Replies

ActionScript 3.0 :: Adding To (Math.random() Within A Number Set?

Apr 29, 2010

I have created a tween with actionscript that moves a movie clip of a cityscape along the x axis whenever the mouse is clicked.

This is my code

var skylineTween:Tween=new Tween(skyline_mc,"x", Regular.easeInOut, skyline_mc.x,Math.floor(Math.random() * (-1022 - -16) ) + -3,2,true);

Right now it generates a random number from between -1022 and -16 (positions along the x axis).

However, sometimes the skyline movie clip only moves a few pixels and looks boring.

I added 200 pixels to the movement (Math.random() * (-1022 - -16) +200 ) and it looks better. However, sometimes this slides the movie clip past -1022 or -16 and off the stage.

How can I set the value to +200 without passing -1022 or -16?

View 0 Replies

ActionScript 2.0 :: Adding Two Number Vars - One Being Pulled From Xml

Sep 20, 2010

I was wondering if it is possible to add 2 numbers together if one of them is being pulled from an xml file,

[Code]...

View 2 Replies

ActionScript 2.0 :: Variables Not Adding Together To Make New Number

Feb 24, 2011

Having some issues with some variables not adding together to make a new number. Instead they are appending to each other as if adding characters onto a string rather than a number. Here is my code.

ActionScript Code:
var dispenserPos:Object = {x1:"41", y1:"180", x2:"283", y2:"180", x3:"530", y3:"180", x4:"775", y4:"180"};
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
[Code] .....

It should be tracing out 388 instead of the numbers appended onto one another.

View 2 Replies

ActionScript 3.0 :: Adding Number / TextField In Ball?

Oct 9, 2009

I have addChild(ball); in a for loop creating many balls. I also have addChild(number); I want number to be placed in the ball mc. So ball.addChild(number);. However the whole thing freezes and takes longer than 15 seconds to load. Is there something wrong with adding number, a textfield, in ball?

View 2 Replies

ActionScript 2.0 :: Adding And Substracting Number Variables?

Mar 19, 2004

If I want to add or substract number variables, how can I name them to indicate they are numbers and how can I do basic math with them? If I try adding common variables like

_root.answer = _root.var1+_root.var2;
and if var 1 is = 1
and var 2 is = 2

The answer is 12 not 3

View 5 Replies

ActionScript 3.0 :: MovieClip On Stage - Adding Instance From Library

Sep 8, 2009

I have created a movie clip on the stage and in symbol properties I have checked "Export for ActionScrip" the MC name is "slide" and the class is "slide" base class is flash.display.MovieClip.

When I test the movie I get this error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main_fla::MainTimeline/frame1()

Here is my code:
PHP Code:
var slide = getChildByName("slide"); //add instance from library?
function slideRollOver(event:MouseEvent):void {
// trace("OK");
} slide.addEventListener(MouseEvent.ROLL_OVER, slideRollOver);

View 5 Replies

ActionScript 3.0 :: Adding Function OnRelease To Instance Of A Button?

Mar 26, 2010

I am trying to add a simple navigation to an instance of a button on my stage through AS3. my code is below... I have used the same code in AS2, but i must be leaving something out in AS3.. 
 
btn_arrow_TL.onRelease = function()    {    gotoAndPlay("flyout_default");    }
  
Compiler Errors: 1120: Access of undefined property click.

View 6 Replies

ActionScript 3.0 :: Adding Random Number To File Name Upload?

May 2, 2009

I have a script to upload images to my server. I want to generate a random number to add to the users file name incase they upload an existing name and write over it. I have created a var called file nameAddOn and it gets a random number. When I trace the var nameAddOn I get the number, but when I upload the file it doesent sent the nameAddOn var with the file name. I cant see anything wrong with the code.:[code]....

View 1 Replies

Flex :: Adding 1 (+1) Not Working On String Cast To Number?

Jan 25, 2011

just learning as3 for flex. i am trying to do this:

var someNumber:String = "10150125903517628"; //this is the actual number i noticed the issue with

var result:String = String(Number(someNumber) + 1);

I've tried different ways of putting the expression together and no matter what i seem to do the result is always equal to 10150125903517628 rather than 10150125903517629.

View 1 Replies

Professional :: Adding Text And A Slideshow Instance Skews SWF Off Screen

Jul 15, 2010

I have a third party slideshow instance (SlideShowPro (SSP)) and have used the following code to allow SSP to resize to screen:

import net.slideshowpro.slideshowpro.*;
import flashx.textLayout.formats.BlockProgression;
stage.align = StageAlign.TOP_LEFT;

[Code]....

It all works fine.  However, I am trying to put in links on the stage outside of SSP (i.e., Home, Gallery, About, etc.) as shown in this example website [URL].  When I do, the stage is truncated and part of SSP is skewed off the page.
 
How do I make sure that my stage containing text and SSP is captured as the SWF?

View 1 Replies

ActionScript 2.0 :: Hide MovieClips At Once By Adding Instance Names To Array

Dec 1, 2004

Is it possible to hide several movie clips at once by adding their instance names to an array, and then creating some kind of function?

View 1 Replies







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