ActionScript 3.0 :: XML Array - "next" Button Isnt Working?
Nov 19, 2009
I am having trouble with my next button and it going through my XML. The problem is that when pressing next the next button everything works until I press it for the 5th time. Instead of it going back to 0 I get error of undefined. I think this is because It is trying to go to the next xml node(?) of 5 but there is nothing there because the XML is 0-4 being a total of 5 items.Im having trouble wording this but I think the problem is something to do with this line "if(currentIndex == productXML.product.length())" because the length is equal to 5. I have tried "if(currentIndex == productXML.product.length())-1;" ... this gives me almost working results where the button will go to 3 and then back t o 0 on the next press... but I want it to go to 4. I cannot seem to do this. I have attached my code and an example ,
It is worth mentining that the back button works great and how it is supposed to but still there is one problem with that too... in order for it to work the next button needs to be pressed atleast one time first.... weird.But the back button functions and will go 0,4,3,2,1, 0,4,3,2,1..... I dont understand why the "next" button isnt working. Its the same thing pretty much.
var productXML:XML;
var productXMLLoader:URLLoader = new URLLoader();
productXMLLoader.load(new URLRequest("products2.xml"));[code]......
Normally i would publish using Flash CS4, however SEO requirements dictate that i need to use SWFObject. now, i have all the same publishing settings as i would have using AC_FL_RunContent.however, it doesnt 'center':
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>[code].......
however when i use SWFObject, i doesnt not extend the dimensions, it does not scale to natual size, and it does not center in the browser. it just sits on the top left of the screen.either there is something very wrong with the javascript or i have made a mistake with the parameters.
is it possible to send string to a class that isnt included in the same fla file.for example portfolio.fla is a main movie, it has an as file portfolio.as, work.fla is a secondary movie it has its own as file work.as, im loading work file into portoflio file and i want to pass a paramenter from portfolio.as to work.as
I'm working on a animation for a charity and i need to make some birds fly around the stage randomly, and change _xscale depending which direction they are moving.I have an if() statement to check if the new destination point is smaller or bigger than the current _x position of each bird. This works perfectly, but when i use the continueTo() method, that if() statement isnt being called.here is the code for the birds.
function flight(){ for (var i=0; i<birds; i++){ var bird:MovieClip = attachMovie("crane","crane"+i,i+1);[code]....
I have a movie that is 2000px in height and some objects are duplicating vertically adding up by 100px. Say I have 5 objects so there is only 500px of content, is there anyway to use javascript from flash to limit the scrollbar to 500px instead of the full 2000?
I have used a method to shuffle a part of a Array, but i noticed that it does not work very well.When i run this method I sometimes get empty array values.So if you would try the example below and test it out some times you would get a right result but sometimes a wrong result.For example when i run this i get in my trace output:
a,b,c,d,g,,e,f (here after the g it goes wrong) a,b,c,f,g,d,e (here it goes right) a,b,c,d,,g,f,e (here it goes wrong)[code]...
I want to take a static text field, convert it into a button, and use it as a button. I need it static, because I changed orientation, and I do not know how to do that otherwise. The problem is, even though I converted it to a Button symbol, it does not work when I test the movie. It works fine with "Enable simple buttons", but when I test it, the button is not there, no change in mouse cursor, no reaction at all.So this is what I did:
Made text. // static, not selectable, Orientation: vertical left to right, / //rotated; Two filters: Drop Shadow and Glow;
Converted text field to Button - Symbol (scrollBT)
Editing the Button,I put the same content (the static text field) in all four frames: No luck, not working. without the Hit frame filled (which I think doesn't really make a difference): No luck, not working.Tried again, converting the static text field in the button into a Graphic Symbol: No luck, not working.Tried again, and put some differences in the frames for "ON" and "OVER" etc.: No luck, not working.Tried again, duplicating a similar, working button, edited it, and: No luck, not working.
To the button itself and the AS: The button will be a scroll-button for a text field, with different scroll speeds on rollover and press, but nothing else. The code for that I have (I think). It's something like (and please excuse my incorrect syntax here, but I'm typing from memory; still, I use the Script-Assistant and my syntax is apparently correct; it's also working with other buttons):
on {rollOver} { function (scroll) { textfieldtxt.scroll - = 1;}[code]....
I'm at the end of my wits. The only difference I can tell from other (working) buttons I did the same way, is that the scrollBt does not do anything except scrolling, while all of the others have frame actions (gotoAndplay etc.) associated with them.
The ad on the bottom right of the screen (the one with lightning flashing) has an invisible button in its Flash file (CS5) linking to [URL]. This file is imported as SWF in Dreamweaver CS5.
The hyperlink works in Firefox, but not in Safari. Maybe it is just my computer.
i have been doing this tutorial http:[url]..but i am stuck on PART 8, i have done everything the tutorial has said so far (although my image and the colors used are different) but the large blank box at the top of the color pallet isnt changing color when i click on any color from the pallet.
Also this tutorial doesnt say what version of flash and actionscript is best suited for this.Currently i am using CS4 & Action Script 2.0 but i don't know if this is correct. below there is a link to the fla. file that Coloring_Book.fla.
i have an MC (hand) that ive made to be draggable. once the hand is released it should return to its original position....but of course, it doesnt. the code is a slight variation of some i found a while back and have kept in a folder. first frame on code layer in main timeline Code:[code]
I am having a problem where my buttons on main timeline are working fine. When I create a button within a movieclip layer (a page importeded from Photoshop as a movieclip) the button is not working once I leave. It doesn't show as a working button when I select Enable simple buttons, when I preview or publish as HTML. The thing is, it is a button, it has an instance name, is that weird blue color... and it works fine when I am double clicked into that movieclip layer. I also tried common library buttons and they work fine until I leave that layer as well, also tried it within other layers and creating a new file and doing it... all no success!
I have an xml file that I load and parse with no problem. I have a number of buttons that are on the stage. I want to link the buttons with the xml file. I have simplified it here
The sample xml file is like this
<xml> <item> <name>George</name> </item>
[code]...
I have three buttons on the stage. When I click button _1, I want to access the value in the first element in the xml file (George). And so on with button_2 and button_3.I'm guessing you put the buttons in an array. How do you link the button array with the xml array?
when my ship lands within certain coordinates i want to add a docking button to to a child of another movieclip. Then I want to add the docking button to an array so that when thrusters are engaged i can remove that child.The docking button does get added to the screen but all i get is undefined when i trace out the the DocksArray.Here's where i declare it up under class:
Code: var DocksArray:Array = new Array();
within the update function i try to trace DocksArray:
I have an an array of objects. I populate the datagrid from the array. The nmber of columns in the datagrid is fix i.e.5 and the first column always shows serial number (0,1,2,3,4). I have a link button called 'CLEAR' in the last column of the datagrid.
1> How do I make the clear button visible only when the row is particularly clicked 2> When the clear button is clicked, how do I make the contents of that particular row cleared. Not deleted, only cleared to insert data again. Also, the serial number (0,1,2,3,4) should not be cleared, nor deleted. How to do this ?
I have an array of movieclip buttons that is a table of contents for a module. I am using a loop function to maintain their down state when clicked. All of the event listeners for each content heading in the table of contents are coded outside the loop and each one loads an external swf file (also in an array). I also have "next" and "previous" buttons that advance the external swf files being loaded but I also want the button array to move forward and highlight the next section. How do I advance the button array outside its loop function?
I'm creating multiple movieclips, containing a TextField and an image as a background. In order to keep track of them I'm storing them in an array. The problem is that I can't add the movieclip to the screen >.< What I'm doing is
PHP Code: addChild(movieclips[0]);
but it's not displaying. I know it's not the movieclip as I can addChild that and it shows, but trying to call it out of the array is not working and it's REALLY frustrating the nark out of me .How do I add the selected movieclip out of my array?
I'm having an issue with my code where im trying to make a different movieclip play every 2 seconds on the start screen for a school project. Simply by changing the array access number however flash is giving me an error code and I've narrowed it down to (i believe anyways)something wrong with my " mcArray[i].gotoAndPlay(2); " because it works fine if i just put the name of the movieclip but not with the array.
The error code is:
TypeError: Error #1006: value is not a function. at OpsAPP2_fla::MainTimeline/onTimer() at flash.utils::Timer/_timerDispatch() at flash.utils::Timer/tick()
I created a prototype function for the Array object. It's supposed to load and parse an XML file, then take all the values from the XML file and convert them to objects, which I then want to push to the array that called the function. However, I can't seem to get it to work.The function itself seems to work, but the push to the array does not. (code below)
Array.prototype.xmltoArrObj = function( path ) { var xmlurl:String = "nav/" + path + ".xml"; var attr:String = "";
i have the following 2 functions.[code]when i called the first function it works... peopleOffBus(); but then when i call the other function to make p visible true, the function peopleOnBus(); doesn't work.it is calling the function but somehow my array is not working or something.
I seemed to have had this problem a few times. I use the <b> (bold) tag in my array and if I don't embed the fonts, the bold seems to work out fine, but once I embed the font, I lose the bold.
I'm trying to set up an app that moves one movie clip to the top of the screen, regardless of where it is or how deeply it is nested. To do this, I take the full path of the movie clip and go in, movie clip by movie clip, putting the depth of each nested clip on top. This part works perfectly. Afterwards, I want to move everything back to where it was. In the first step, I store the current depths of everything in an array before changing depths. In the second step, I'm trying to change everything back to its original depth, as shown in the array.
The code is below: _global.videoPath = _root.clip1.clip2; var pathString = String(_global.videoPath); var videoPathArray = pathString.split("."); var depthArray:Array = new Array(); [Code] .....
I'm having three movie clips, which I would like to move randomly within a set box. The following script works with one movie, but not with all movies placed in an array.
var clipSpeed:Number= 1; var speedX:Number = 0var speedY:Number = 0 var upperLeftLimit:Point = new Point(0, 0)var bottomRightLimit:Point = new
I'm creating an array of thumbnails. The images are being read via an xml file. This works fine. What doesn't work is the TextField I put underneath the thumbnail image.
Code: Select all var thumbContainer:MovieClip = new MovieClip(); thumbContainer.addChild(loadedThumb); var sl = new slNum_mc; //This is being referenced as a class from the library. sl.slideNumber.text = "abc"; //slideNumber is a dynamic textfield in the movie clip class sl, the initial sl.slideNumber.y = 90; // text "abc" does apply at runtime thumbContainer.addChild(sl); addChild(thumbContainer); searchSlideArray.push(thumbContainer); //Adds it to an array I already set up
This much does work. But when I try to trace it like this: Code: Select alltrace(searchSlideArray[0].sl.slideNumber.text); I get an error. How can I correctly reference the text in a text field that is housed in a movie clip class?
I'm trying to check through an array to see if any of my movie clips are currently on frame 15, before taking giant leaps I was trying to just get it to work with one var in the array before all of them, for some reason this code is not working, the trace is not coming up.
If someone would like to go a step further and show me how to check through all movie clips. There will be many more than btn1_mc and btn2_mc so I will definitely need to use an array.
I'm setting up a class of public static vars that are to be BitmapData.
The problem I'm having is I can't seem to reference the vars dynamically in an array, making it impossible to give them values without some serious procdedural style coding.
Should I assume it's because my array is a private var and placing references to public static vars is illegal? Is somebody gonna call the flash police on me?