ActionScript 3.0 :: Referencing A Dynamic/scalable "y" Position?
Oct 24, 2010
I'm including an image which will help describe my problem. I want two gradients to expand from the top and bottom of the page, to have their bottom and top edges respectively stretch and connect with an another object's top and bottom edges located in the center of the screen, scalably and dynamically.
indevelopment.outsidethemenu.com/pageLayoutHelp.jpg Since the middle area's "y" is scalable and dynamic, the "bottomContainer.y = TextArea.y + TextArea.height;" which I am using is not working, for example.
View 1 Replies
Similar Posts:
Feb 14, 2011
I'm trying to read an XML file with actionscript 2.0
The problem is I can only make my code to read a value of a tag by referencing their position.
e.g.
var currentIcon = myXML.firstChild.firstChild.childNodes[0].firstChild;
How do I retrieve a value from an XMl file by referencing their tag name?
e.g.
var currentIcon = myXML.firstChild.firstChild.childNodes['icon'].firstChild;
Here is my XML file...
<weather>
<current>
<icon>Partly cloudy</icon>
[Code]....
View 1 Replies
Dec 11, 2010
i'd trying to build an interactive tree that allows the user to move the tree's branches and nodes. the lines (branches) of the tree are drawn programmatically between points (nodes and tips). i'd like for the user to click on points to drag them while having connected lines and points move correspondingly. i've gotten this to work to some extent using the code below:
ActionScript Code:
function startMoveOa(evt:MouseEvent):void {
thisPtOa = Sprite(evt.currentTarget);
[code].....
View 2 Replies
Sep 22, 2010
I'm making a flash game in which I need to spawn movieclips and I am attempting to use dynamic referencing to cut down on the number of lines I need to write.
[Code]...
View 7 Replies
Oct 24, 2008
The following code is my attempt to fade out current clip then to fade in selected clip via one onRelease command. Here's the code. Can someone set me straight?
Code:
import gs.TweenLite;
import gs.easing.*;
var whoIsOn:Number = 0;
var clip:Array = ["orange","cranberry","melon","mango"];
[code].....
View 1 Replies
May 25, 2010
how do I reference a dynamic text field in my fla file from a class which isn't the document class? For example: I have an fla file called main.fla which contains no actionscript and has a single dynamic textfield called "text_txt" on the main timeline.
[Code]....
View 8 Replies
Oct 15, 2009
how do I reference a button that has been loaded dynamically?Furthermore, is it possible to use the removeMovieClip() method with a button that is inside the movieClip you are trying to remove?Simply put, I've got a movieclip that is loaded via the "attachMovie" method. There is a button inside that says "Close". I am trying to use the removeMovieClip() method on that button, but it's not working. I can put a button on the stage, and use the same method, but it doesn't work.
View 4 Replies
Oct 22, 2009
First of all: this is my first post at actionscript.org *happysound*. I'm working on this flash gallery since a couple of days and something is drinving me crazy in actionscript.
The concept: in this part of the flashfile i'm loading thumbnails in dynamicly created movieclips on stage (1.jpg, 2.jpg, 3.jpg). Everything is working fine, but now I wanted to add some fancy fading when the loading of a single thumb completes. For some reason I can not get the tweening class working and I'm sure it's a problem with the referencing to the clip. I know this cause when I change "thumb"+i to thumb1 it is working. Googled for hours without result..
[Code]...
View 5 Replies
May 25, 2010
how do I reference a dynamic text field in my fla file from a class which isn't the document class?
For example:
I have an fla file called main.fla which contains no actionscript and has a single dynamic textfield called "text_txt" on the main timeline.
My class file is called aClass.as and is the following:
package
{
public class aClass extends MovieClip
{
[Code].....
View 1 Replies
Feb 19, 2010
I am building a drag and drop application. I have a few items within a movie clip that are movie clips. They each have their own instance name.
I am trying to access them from the document class using 'event.target.name'.
That works and I can pick up the name of the movieclip.
I put it in a string var called tName.
Then I try to modify a property of the selected movieclip:
itemList.items.tName.x+=23;
thats when i get, 'A term is undefined and has no properties' error.
I know itemList.items.tName is the correct navigation to the clip, because if i replace the var and hard code the correct name, it works.
whats funny is my tName var is tracing out the correct name of the movieclip.
Or a better way to dynamically access mc's within mc's.
View 1 Replies
Feb 23, 2009
I know that a dynamic mc can be referenced using array notation
viz: myArray['someName'+i]
My question is ... can mcs that have been placed on the stage and given instance names be referenced in some similar way? If I have placed 10 mc's with different instance names eg mg1, mg2, mg3 etc, can I reference them using array referencing?
View 6 Replies
Jan 4, 2006
i'm looping thru xml nodes and using this to attach clips to an empty mc:Code:item = _root.mainHolder.links.linkHolder.attachMovie("linkClip", "linkClip" + i, i);my question is how can I reference the previously attached clip so I can determine the _y property of the current item(clip).I'd like to do something like this.item._y= previously attached clip._y-previously attached clip.height
View 10 Replies
Dec 7, 2010
I am adding a bunch of MC's(linkage ID:buttonHolder) dynamically using a for loop and attachMovie. If I want to dynamically add an onRelease function to each of those MCs,so that each of them links to different links how would I accomplish that? here's where i've reached so far..
var depth:Number=0;
var nextY:Number=77;
for (i=0; i<5; i++)
[Code].....
View 1 Replies
Jan 1, 2012
I'm making a function, and I want to pass it's handling less restrictively, kinda like jQuery I guess.
Code:
function cfunc(min, max)
{
return (Math.floor(Math.random()*(max-min))+min);
[Code]....
Now I know that alternately, I could pass them individually to the function and then join them all together as one, but I'd prefer to use one variable and pass the data through it, kinda like a scripting engine.
View 1 Replies
Nov 13, 2004
I posted this a few days ago and am still stuck. I have read a myriad of tutorials on arrays, and still cannot fathom out where I am going wrong. I have commented the code. The story is as follows: I want to be able to create a dynamic list. In the library I have exported for .as a movie clip given the name "nav"
[Code]...
View 4 Replies
Nov 17, 2011
ther am having problems with my flash code.I have an xml file with the following structure:
<buttons>
<button>
<id>Garden</id>
[code].....
View 1 Replies
Jun 26, 2009
I'm doing this object oriented game and I create a bunch of 'boxes' via a for loop
Code:
Select allfor (var z=0; z < numOfBoxes; z++){
var box:Object = new Object();
box.mc = new Box();
box.mc.name = "box"+z
box.mc.x = Math.round((Math.random()*(530-box.mc.width)) + 20);
for (var i=0; i<boxXArray.length; i++){
[Code] .....
I get my random amount of boxes scattered over my stage (I haven't put in any checks to see if they are touching). How do I 'name' these boxes so I can reference them later? Say I want to move the .x of boxA in another function? Is there a simple way to call them box+z instead of just all as box? (Then I can run them through a loop later to talk to them).
View 2 Replies
Mar 11, 2004
I'm using duplicateMovieClip to create instances of a clip. Then I use an array to name the clips. In the scrip that duplicates and names them, I also have an onRelease function to make the mcs do something when you click them. I can't get this onRelease part to work.
I need to:
- swap the depths
- load some text
- attach a movie from the library
I can't see any errors with my script, so I hope someone can look at it and give me a clue. The part I'm having trouble with is:
[Code]....
View 1 Replies
Jun 23, 2011
I have created a movie clip with the following path to a dynamic text field:
_root.i_lotteryball1.i_ballstrip.i_text.d_text1.text = _global.text1;
I have then duplicated the 'i_lotteryball1' movie clip, and called it 'i_lotteryball2'.When I try:
_root.i_lotteryball2.i_ballstrip.i_text.d_text1.text = _global.text2;
It changes the text in 'i_lotteryball1' text field aswell as 'i_lotteryball2' text field with the value of '_global.text2' How can I update each text field with different values.When I try to change the instance name of the text field inside 'i_lotteryball2' to 'd_text2', it changes the 'i_lotteryball1' text field instance name aswell to 'd_text2'!
My objective:
_root.i_lotteryball1.i_ballstrip.i_text.d_text1.text = _global.text1;
_root.i_lotteryball2.i_ballstrip.i_text.d_text2.text = _global.text1;
View 7 Replies
Jul 30, 2009
I have a widget containing a number of displayobjects, i.e. up arrows, down arrows, tab 'buttons', backgroundrectangularblocks, sliders, company logos etc.I am currently creating these displayobjects using the graphics class with parameters taken from an external file, things such as fontsize, font, colour, width, height e.t.c and adding them as children of "container" sprite objects for easy manipulation and referencing later can these assets be loaded in their entirety externally, rather than being created using graphics class draw methods (which I want to avoid) as some of the things I need to design cannot be created in pure actionscript very easily (if at all?), and then used or do they always have to be in the library and instantiated from there?
if the first question is yes they can be loaded externally, this question probably isn't needed; however, if I have to put the items in the library and recompile each time a client wants to use say a curved blue up arrow instead of a yellow one and then decides he wants a yellow circle instead then how do I write the code to do the following:-Say on my first ever compile I have 'upArrowBtnset1' in the library, I instantiate it and use the instance name to access it in the usual way using standard code,
upArrowBtnset1.addEventListener.... container.upArrowBtnset1.scaleY = .3 e.t.c
Now if they send me a second set of 'upArrow' graphics they want to use I could either update all the upArrowBtnset1 assets with the new graphics meaning the original set is no longer available to the client and I would either have to hold a "original set" FLA file with the first set of arrowbuttons or I could import these to the library as upArrowBtnset2 and a third set they send as upArrowBtnset3 and so on each time I am sent some new assets; I would then recompile them into the SWF and adjust the references to the new assets within the code. In the code, for each instance of "upArrowBtnset1" I would have to rename them to "upArrowBtnset2", recompile and send it back to the client.
Because I have already abstracted the font/colour/size choices out to an external file, they can change that as much as they like without a recompile which is what we want. The problem comes if they want to use set1 again and haven't kept the original "set 1" compiled SWF. It would be easier to abstract the 'setchoice' also to the external file. The SWF would over time build more and more available sets that they could use by just changing an external variable.
For example, if the designer wants to use set 1 on Monday, set 2 on Tuesday and set 3 on Wednesday I want to make it so they can just adjust an option in an external file to "setchoice = 3" for weds instead of either having to recompile the swf each time or they have to have 3 versions of the SWF for each asset set. The idea is that as more and more assets are added in, they have more and more choices. Ideally, in an external file there would be a list of assets and links to where they are loaded from. (i.e question 1 above).
If I have an external file (say XML) which holds the setchoice option that the designer wants to use (say they want set3 today) my 'generic' code has to be something like upArrowBtn(setchoice).scaleY and every instance in the code where that object is used I append the 'setchoice' as chosen by the designer from the external file where (setchoice) is retrieved from something like var setchoice:String = "set3"; from the external file (I am currently abstracting all the adjustable variables to a configuration.as file. I will work on using an XML later when the principle of external files works (I hope!);
Is it possible to import assets from external sources and then use them in the SWF as if they were in the library? The loader class? Is this just fraught with danger I wonder.
Essentially I am being asked to remove as much as I can from the SWF so that if the client wants to change the positioning of things on the stage or the text on buttons or change the style of the buttons or the company logo they don't have to come back to us to ask for a recompile of the SWF for each tiny adjustment. Inevitably SOMETIMES a recompile will be unavoidable (such as if they want the widget to suddenly be twice as wide (i.e. the stage). My code already handles some of this using stage.stageWidth and then positioning objects relative to other objects already on the stage using this value and centred so that just changing the document properties is all I would have to do and everything else adjusts proportionally. I am trying to make this as reusable as possible with as little effort from myself as possible to save our company wasted time.
After all that waffle, my question is this, if I can't load all my buttons and assets and things externally, how do I write the code for this:- I have a library asset called upArrowBtnset1 and another called upArrowBtnset2. Instantiated with say upArrowButtonset1 and upArrowButtonset2 The code would normally be upArrowButtonSet1.x = 100; upArrowButtonSet2.y = 300; but I need it to be upArrowButton(setchoice).x = 100; upArrowButtonSet2(setchoice).y = 300; where (setchoice) comes externally from var setchoice:String = "set1";How does the code change if the (setchoice) string was named not at the end i.e 'button(setchoice)UpArrow'?
ActionScript Code:
var numClips:Number = 5;
for (var i:Number = 0; i < numClips; i++)
[code]....
I need to do something like, getChildByName("mainTab"+i).addChild(myMovieClip) ? or maybe this["mainTab"+i].addChild(MovieClip)?Is it possible without using .name?
View 0 Replies
Aug 1, 2010
I have been trying to search for an answer on how to make a whole .swf file unscalable but I have only found information on how to scale flash files. I did find a post that mentioned the code "Stage.scaleMode = "noScale";" but when I add that to the first frame in my timeline, nothing happens.
View 2 Replies
Feb 9, 2009
Does anyone know how I can make a scalable swf? Or one which resizes to the page it is in?
View 1 Replies
Mar 28, 2011
Is it possible to keep an object no scalable while its parent is scalable?? I have text inside a scalable mc and the text is scaling together with the mc when the stage is scaled.
View 3 Replies
Feb 5, 2009
how to make a flash movie scalable? So it can resize without pixelating etc.?
View 0 Replies
Jun 11, 2009
I am in the planning phase of a new multi-user client/server app using Flash via Flex and AIR. I am trying to decide which web platform/stack is the best suited for this? I have used RoR in the past, but as i understand, RoR is single-threaded, and is therefore not the ideal choice for handling potentially thousands of simultaneous requests. I have done some reading about Scala and Lift and that is an intriguing option, but i was wondering if there are other languages/frameworks out there that would work well for my project?
View 3 Replies
Jan 13, 2010
[URL]I need some easy tuts on this, there are a few on here but which are good tuts?I know some items are fluid, and centered, but how do i do full browser scalable images with menu on top or below?
View 8 Replies
Jun 6, 2007
How do I accomplish the Flash scroll bar that is on the following website?[URL]..Since the site is non scalable and at full screen IE doesn't scroll. On this website they have created a scrollbar in flash aligned to the right side of the screen that accomplishes the same thing as the IE scrollbar. But it looks so much cooler.
View 3 Replies
Jan 15, 2009
I recently found a great tutorial for making a scalable background image on: [URL] which has worked a treat. But my content is now positioned top left. How can I centre it without effecting the background? The full code I'm using on the first frame is below. I can centre all the content by changing Stage.align to "T", but then the background image has a nasty white space on the left hand side when the user resizes the browser.
I'm a flash newbie, can do some basics:
//set stage for FBF
Stage.align = "TL";
Stage.scaleMode = "noScale";
//define dynamic aspect ratios
picHeight = new Object ();
picHeight = pic._height / pic._width;
[Code] .....
View 6 Replies
May 21, 2009
I'm trying to create a simple splash page for a site that has a scalable background animation, with a fixed size content animation that will stay centred for different sized browser windows or if the window is resized.[code]In general am I on the right track to achieve something similar to the example I posted? Is there a better method to use?
View 1 Replies
Nov 16, 2009
I've created a flash file which loads an image using loadMovie, this all works fine but what I need to be able to do is load different size images into the swf. I have tried changing the size of the swf in the embed tag and using the 'noscale' option, however the stage appears to be moved to the center (see screenshot), I need it to be at the top left.
I've also tried passing the new width and height to the swf via flashvars and then setting the size of the stage to these values, however this makes no difference to the outcome.
how I can create a flash movie that I can scale using the width and height parameters that doesn't scale the content and keeps the content in the top left corner?
View 2 Replies