ActionScript 3.0 :: Flash Dynamic XML Buttons Size And Placement With Masking?
Dec 3, 2011
making an XML menu for a website. Each button has a background and and over-state background. The backgrounds are 9 sliced scaled movie clips, well the over-state background is set up to mask an animation movie clip that is larger than any button will be. The mask is 9 slice scaled and is always the same size as the regular background. These backgrounds are x-scaled in a function in the Button.as. The title passed in through the XML determines the width. All of this so far works perfectly.
Now a navigation movie clip processes and adds all of the button movie clips based on the amount of nodes in the XML, this also sets the X and Y coordinates as well as sets a "spacer" between the buttons. Here is my problem, every time the function runs to create a new button, it sets the x value at:
Code:
button.x = this.width;
This is great if I don't use the mask though. What happens since the movie clip I am masking in the over-state background is wider than the buttons are is that there is wayyy to large of a gap. When each button is added, actionscript sees the width of the button with everything in it, masked or not. So I've tried a for-loop in the button creating function to increment a number variable from 0 - the max number of buttons in the XML. I then want to set the x value to:
Code:
button.x = (button.background.width * i);
This is the background of the button that has the correct width that actionscript should be using. By multiplying it by the i variable, it should move the x right with every button. Unfortunately it's not working.
View 1 Replies
Similar Posts:
Dec 3, 2011
what I am doing is making an XML menu for a website. Each button has a background and and over-state background. The backgrounds are 9 sliced scaled movie clips, well the over-state background is set up to mask an animation movie clip that is larger than any button will be. The mask is 9 slice scaled and is always the same size as the regular background. These backgrounds are x-scaled in a function in the Button.as. The title passed in through the XML determines the width. All of this so far works perfectly.
Now a navigation movie clip processes and adds all of the button movie clips based on the amount of nodes in the XML, this also sets the X and Y coordinates as well as sets a "spacer" between the buttons. Here is my problem, every time the function runs to create a new button, it sets the x value at:
Code: Select allbutton.x = this.width;
This is great if I don't use the mask though. What happens since the movie clip I am masking in the over-state background is wider than the buttons are is that there is wayyy to large of a gap. When each button is added, actionscript sees the width of the button with everything in it, masked or not. So I've tried a for-loop in the button creating function to increment a number variable from 0 - the max number of buttons in the XML. I then want to set the x value to:
Code: Select allbutton.x = (button.background.width * i);
This is the background of the button that has the correct width that actionscript should be using. By multiplying it by the i variable, it should move the x right with every button. Unfortunately it's not working.
View 7 Replies
Jun 6, 2011
I have a site that has multiple pages of similarly sized buttons. These are magazine covers. I'd like for the mag covers and links they point to (loaded swfs) to be dynamically loaded via a text file, if possible. The client always has new magazines she's been in and to manually load the newest buttons first is time consuming.
View 3 Replies
Jul 25, 2010
i made a masking anim using frame by frame animation on the mask layer...
when i exported the swf it was of 83 kb (too huge) and i checked it was all due to shapes in the mask layer....
i found "eltima swf optimizer" on internet but it gives only black and white output in the demo version ....
i opmitized all shapes one by one by using modify>shape>optimize using 100% optimization but when i exported swf this time was 114kb(even more) this sux!!!
my question is that is there any other "swf optimizer" that i can use for free.. (hey its my school project and i just need to mask a single jpeg)
View 1 Replies
Oct 13, 2003
is it possible to get an uh... "absolute" X and Y for _root.dropDown1MC.listMC.item? As is stands, I'm placing dropDown2MC on the stage using the following code: [AS]_root.attachMovie("dropDown2", "dropDown2", 30, {_x:_xmouse, _y:_ymouse});[/AS] and that gets it on the stage, but it doesn't function as I need it. In a perfect world, I'd like to place dropDown2MC at the X and Y of item, BUT, there is a mask to only show a certain area of listMC (it's how I'm making a scrollable dynamically populated list).
So, is there a way to get some sort of absolute value, relative to root or something, of item's X and Y coordinates? Sorry if this is a bit complicated... I'm trying to be as clear as possible, but you know how hard that can be when you're connected to Flash directly though a firewire cable to the brain
View 4 Replies
Dec 18, 2006
In the code below, I am loading in multiple images from based on an xml file. I am looking for a way to dynamically place the images depending on how many results are brought back. I have the starting points for the first image in each section in the code, I am trying to basically add about 40 pixels to those numbers for each image
Code:
var xml = new XML();
xml.ignoreWhite = true;
[code]....
View 1 Replies
Dec 31, 2009
what I'm trying to do is attach instances of a movieclip on stage, one by one, so they form a shape similar to one of examples below...(each dot would be a movieclip)I know I should do it using loops and probably sin/cos math methods, but am not sure where to even star
View 1 Replies
Aug 11, 2009
I'm creating a playlist for a music player, and I've got the song names displaying correctly in my songTitle holder MC, but there's limited space for the song names to be shown in, and I'm going to eventually have it inside a scrolling movieclip. Problem is, the text inside the textfields disappear when I try to add a mask to the movieclip they're being loaded into. I've tried adding all combos of embedFonts, antialias, and blendModes I ran into, to no avail.how to mask dynamically created textfields with a non-dynamic (Flash IDE-made) mask.
Code:
for (var i:int = 1; i <= _size; i++) {
var pl_artist:TextField = new TextField;
//all embedFont = true and antiAlias commands no workie
}
View 4 Replies
Sep 13, 2010
I'm trying to print an MC that is on screen with a dynamic text field in the MC - its printing just fine but the placement of one of the elements is off. Basically I have a dynamic text field centered on the stage, however when I print it, the text field moves to the very right on the printed page, while the rest of the contents of the MC stay centered. To clarify on the printed page I basically have this nice page with centered text, but the dynamic textfield is moved all the way to the right of the page.
View 1 Replies
Nov 15, 2009
I've been having some trouble with this code:
Code:
onClipEvent(load)
{
_root.stop();
dO = 3.6;
r = 75;
[code]....
I've created a movieclip with a donut graphic.Set the actionscript to the clip. Created a 2nd frame in the timeline with a photo.Nothing happens.
View 1 Replies
Feb 3, 2009
I'm loading images into an otherwise empty MovieClip called container_mc using UILoaders and spacing them horizontally. I also have the image names as TextFields below the images all within the container. I'm masking the container clip using the following syntax:
container_mc.cacheAsBitmap = true;
mask_mc.cacheAsBitmap = true;
container_mc.mask = mask_mc;
This USUALLY works, but for some reason when I load over 20 images into the container -- the mask no longer works. At first it appears as though it's working but then the text disappears and when I mouse over the images to scroll them horizontally, the mask (which is magenta) appears and disappears -- flickering strangely. Should I be caching? I was under the impression I had to for the dynamic text to show up. Maybe it's the where I placed the code (load-order)?
View 0 Replies
Nov 15, 2009
I can't get this code to work. Is this complete?
[URL]
Code:
onClipEvent(load)
{
_root.stop();
[Code].....
View 1 Replies
Jan 3, 2006
Ok so I'm trying to make a navigation system that is loaded from an XML file and has sub menus. Trying to do it ALL in AS. I don't have any symbols in my library except for the embedded font. Now, sometimes I need to mask something, is it possible to use a dynamically created mc to mask another dynamically created mc dynamically oh, did I forget to say dynamically?? Ok so let's use this as an example, two boxes. One orange, one purple.
Code:
mask = createEmptyMovieClip('orange', 1);
mask.moveTo(50,22);
[code].....
View 1 Replies
May 26, 2009
I draw a shape with the AS3's drawing API, then I draw another shape that intersects the previous shape, both the shapes have fill in them, but the intersecting area does not have any fill. I am not able to manage the "direction" that the shape is drawn in. what I need is for flash to just fill everything up to the outer borders of all the shapes, how would i achieve this? I found this forum thread that has almost the exact same problem that i have, but it is not resolved. [URL]
View 4 Replies
Mar 9, 2009
I have a 8x 10 array of mcs on stage each which contains a small image. So, there are 8 parent clips (columns) each containing 6 child clips containing the thumbnail images. If the movie clip arrays are created dynamcally (therefore loaded into the top layer) how can I mask them? I'd like to be able to mask 1 vertical (parent) column at a time (so only 1 of the 8 columns (6 images) is visible.
View 14 Replies
Feb 28, 2007
And my problem isn't the mask but the dynamic text is not loading from the XML file anymore.I think this is because in the tutorial the first thing you do is make the dynamic text field a movie clip. As soon as I do that the text data doesn't load from the external XML file. The code that previously worked was:_root.prompt = this.firstChild.childNodes[1].firstChild.nodeValue; prompt_txt.text = _root.prompt;But now I made the dynamic text field prompt_txt a movie clip named prompt_mc and it doesn't load. So I realize now that prompt_txt lives inside prompt_mc but how do I get the text data from the XML file there???
View 4 Replies
Jul 1, 2004
I'm loading 10 jpg images into _root.content.section_4.mc_anim, each is placed into its own movieClip.
Code:
_root.content.section_4.mc_anim["gall_img_"+img_view_index]
These movieclips are hidden and then have the images from an array loaded into them.
[code].....
View 1 Replies
Aug 14, 2009
I cannot get dynamic text fields to display when using a mask. Here is what I have done: Created a new Font object in Flash - Linkage: Export for Actionscript , class: Euro
[Code]...
View 4 Replies
Mar 25, 2009
it is masking some dynamic content that is brought in through an external swf. there is a dynamic text field and also a picture loader. whenever either one of these changes, the mask gets all distorted with holes/lighter areas in it.
View 1 Replies
May 24, 2009
I am creating a photo gallery using xml and a thumbnail bar at the side. I want each picture to fit into a square without distorting the image, so I will need to use masks. Currently I am using the loadClip metohd for loading pictures then I am attempting to use onLoadInit to dynamically set the masks. It is hard to show the problem on here so I have here's the link..[URL]...
It seems that you can't place "i" values in the onLoadInit part which I tired previously, atm I can only get one to work as you will be able to see.
View 2 Replies
Aug 3, 2009
In my current project I'm building a waterfall. Each drop in the waterfall is generated from the waterfall.as class and added to the stage via addchild. Now I have a mask that I want all of those drops to use however I can't seem to get this to work. I've tried placing the mask on the timeline and I couldn't seem to access the mask from the waterfall.as file. I've also given the mask it's own class and added it dynamically to no avail.
View 7 Replies
Nov 8, 2010
when adding a mask to a parent sprite with a dynamic text field, the text loses anti-aliasing. how can i maintain the text's anti-alias while still applying a mask to its parent, and subsequently to itself.the font is embedded, and the text field will be animated so it must also be masked along with its parent.
package
{
import flash.display.Sprite;
import flash.display.Shape;
import flash.text.*;
[code]....
View 1 Replies
Aug 7, 2008
Im looking to make the flash file dynamic so that when someone changes the window size the flash file expands with it and some of the items contained move also.
View 3 Replies
Feb 23, 2010
I'm building text balloons to display variable length messages in Flash. My question is pretty simple, though the answer may not be.The string I want to display.The font information.The width/height ratio I want the text field to have.How do I calculate the width and height of the text field it needs to display the text I give it, nothing more, nothing less?
View 2 Replies
Jan 3, 2011
Is there any kind of a standard for the location (padding) and size of the usual "ok" and "cancel" buttons on a Flex pop-up dialog box? In another stackoverflow question it was suggested that the approach be host operating system dependent (e.g. Windows vs Mac vs Linux).
View 1 Replies
Jan 17, 2012
I've made a image slider Class and works fine up to the position of the mask. In my Home Class I make an instance of the image slider Class and position it accordingly. The images in the slider Class are position at 0, 0 as well as the shape I use for the mask. Here is the problem the mask placement is at stage.x = 0 , stage.y = 0 rather then the slider's Class x:0, x:0. Why is the slider instance showing the in right position but the mask in the instance isn't?[code]
View 1 Replies
Jun 14, 2004
I've been using sen's flash/xml drop-down menu tutorial, and I have been able to create the following for (mt):url...If you rollover the first item, you will notice that the submenu loads to the right side. What I would like to have is something similar to the following attached image. Also, the code I am using can be found in the attached FLA.I know how to make the menu appear directly below the parent node, but the problem is that I am unable to shift the menu items down so that the menu items don't overlap over the existing menu items. You can see an example of what I am trying to do in the attached image.Does anybody have any insight on how to accomplish that. I tried finding the name of each movie clip and shifting them downward, but it seems that none of the movie clip names correlate to the actual menu item - therefore, I am unable to shift them downwards in order to make a space for them.
View 14 Replies
Apr 21, 2009
I am a newbie in Flash CS3. How to resize the width of of a movie clip according to the size the size of dynamic text inside it. I did it by creating a text field 'myText' and then converted it to a MovieClip symbol and named the MovieClip as myClip. The text in myText is assigned at run-time and its width changes according to the text.
I did it as follows:-
myClip.myText.selectable = false;
myClip.mouseChildren = false;
myClip.useHandCursor = true;
myClip.buttonMode = true;
myClip.myText.width = myClip.myText.textWidth + 5;
On doing this I find the clickable area changes according to the size of the text field but the text field doesn't appear at all.
View 1 Replies
Nov 10, 2005
I'm trying to use the snow sample supplied in the tutorials. In addition to altering width and height, I need to be able to place it...Essentially what the final outcome is to put snow in a globe.Is there a way to change placement in x and y? I only see overall movie size. Also, is there a way to mask it? and the kicker to all this is that I have a deadline of today,
View 4 Replies
Nov 5, 2009
I have a flash ecard that I am working on and had one of those "wouldn't it be cool if..." moments!
I would like find out if it is possible to:
1) load in an xml file that contains several names
2) Load each one of those names into a predefined movie clip which would display the name
3) randomize the placement of each name in a given shape area so that the Movie clips with names would randomly fill in to make a specific shape.
View 1 Replies