ActionScript 3.0 :: Passing Buttons Names To External .as File?
Jun 5, 2011
I am working on a project where I have on the stage 8 movie clips, and when hovered, they are to shake. I have made this into a class, and placed the code as an external .as file.
Each movie clip is named shaker_mc - shaker_mc7
I have also gone in and changed all of the button movie clips base classes to ShakeButton.
Right now I am getting a couple of errors, and I believe all i need to do is pass the buttons names to the class in the external .as file, but I am not sure how to do that? I had everything working without the external script, but I did not want to have to create the effect for each button.
I have a flex application that reads from external XML file(URL loader) and displays graph. My xml file is dynamically generated using PHP and the filename=currentloggedin user name(i.e. username.xml).How should I load the xml into SWC? Will Flashvars work? I have a HTML page that has PHP code to get username and the same file embes the swc. How to pass the PHP varibale to my SWC?
I have a movie player that works fine when i hard-code the url value in the video function, but when i try to pass that url/file path from an external file, the video doesn't load. I suspect that there is something i'm doing wrong with the quotes. What am i doing wrong?
I've done some googling for the past hour, but I can't seem to find what I need.Maybe I'm overlooking something.I want a very simple, basic thing. But I have no clue how to do this.I have an external XML file which holds a list of names.I want these names to be pushed/added to an array so I can access it based on it's position in the array. (A for loop is used to read a different XML file and the child[i] is named after the same array spot, childName[i]
I have a .exe file (it is a player) i need to pass a parameter to this player so it could play a specific file ( the parameter is the name of this specific file ).
probably a hugely embarrassing beginner question, but I can't seem to find an answer anywhere. I think it's probably (hopefully?) just a syntax problem I'm loading the content of a dynamic text box from an external .txt file and I'm trying to find a way to change the content from a link in the .txt file (if that makes sense). The code I'm using to change the dynamic text box at the moment is:
I have been working on a Flash movie that loads variable data from an external XML file and dynamically displays the item names in a menu which may then be clicked to display other dynamically-loaded content that corresponds to the menu item that was clicked. I have now come to a standstill in the project as there is something I'd like to achieve but simply cannot work out how. This is my first attempt at working with XML in Flash and one of my early attempts at using variables. What I'm trying to achieve is; once the user has viewed the item's content, they can simply click "next" and "previous" buttons to display all of the content for the next or previous items in the XML document.
I know it probably sounds simple and I'm sure some of you could achieve this in 5 minutes (!) but I can't get my head around some of the coding. I assume previousSibling and nextSibling would come into play here as well as some sort of functions which access arrays of data for the previous and next items, but I'm just not sure how to correctly put these things to use. Rather than post my code and example images of the stage up here on the forums, I've created an html page here: [URL]
How do you pass instance names into arrays? I've got a bunch of movieClips of states.
They all have instance names.. alabama, arkansas, delaware, florida, georiga, etc..
I am trying to send them all to an array because I need to be able to disable the movieClips all at once and I don't want to call each one separately. I setup an array and a "for" loop, and it properly gets each value in the array:
ActionScript Code: states = new Array(alabama, arkansas, delware, florida, georgia); stateslength = states.length;
Is it possible to pass variable as arguments for a function? I wish to update a boolean variable via a function, by passing the name of the variable to the function, like so:
Code: function ENVSegment(curSegment:Boolean, nextSegment:Boolean) { curSegment = false; nextSegment = true; } var attackSegmentIsRunning:Boolean = false; var releaseSegmentIsRunning:Boolean = false; [Code] .....
Much shorter, and easier to understand. Also, less repetition of the same blocks of code over and over...
I made this function,that is supposed to create a bunch of slides based on a parameter. That parameter should be the instance name:
Code:
function createSlide(instName:Object){ trace(instName); this.createEmptyMovieClip(instName, this.getNextHighestDepth());[code]....
In the script I call the function with
Code: createSlide("mySlide");
After execution, this error message appears: Error: A 'with' action failed because the specified object did not exist.The trace statement returns the instance name -"mySlide"- When I replace instName with a stringtype name like "mySlide", it works fine.But I don't want that 'cause in that case I have to write a specific function for each slide.
ive been trying to get some buttons to load into my main movie called rules.swf using an external actionscript file. Ive got the buttons to load into the movie but now i cant get the buttons to load a new movie,Heres part of my code
I built a flash site. The site's navigation is an external swf file. The file loads fine. However, the buttons within the external swf file do not work. I have a simple goto webapage behavior attached to each of them.
I'm assuming it has something to do with paths. I do not know what the proper code is in order to make a button inside an external swf file change the web page.
I am working on a website, its a project, I built custom buttons and used there own AS3 to make them play on hover. There is one problem thou, in my main scene or timeline I created this function:
about_but.addEventListener(MouseEvent.CLICK, function(){ var aboutURL:URLRequest = new URLRequest("about.swf"); }) contact_but.addEventListener(MouseEvent.CLICK, function(){ var contactURL:URLRequest = new URLRequest("contact.swf"); }) cat_but.addEventListener(MouseEvent.CLICK, function(){ var galleryURL:URLRequest = new URLRequest("catalogue.swf"); }) port_but.addEventListener(MouseEvent.CLICK, function(){ var portURL:URLRequest = new URLRequest("port.swf"); })
Ok but it had the navigatetoURL function but I took it out. Reason is because I want these buttons to load in a movieclip (mc_loader) as external swf files. I am not sure as is to linking these buttons to the loader movieclip.
When I add two or more the same buttons and changing the name of one, the name of the others also changes. How to set different names to each button? I tried creating buttons by copying, duplicating and nothing...
i have 20 buttons, and i want to design an external file that holds the coordinates for each named button.how would i go about this, since the external file would be read as a string by flash?
I have an XML-file.I want to base an menu on my website om this information.Let us say that I have info in the XML-file with the names "About Me", "Articles" and "Video".Then I want three buttons with the text above on them. This is successfully done.The problem is, that I don't know what button I am pressing. To go to the nest page I need to know what button I am pressing.
I've tryed the following:
Code: Select allprivate function buildMenu():void { for (var i:int = 0; i < menuArray.length; i++) {
[code]....
The result is that all the buttons get the name of the last entry in the XML-file. In the case above all the buttons would get the name "Video".
I am amateur in flex, and started my final year project in flex to learn it, I am stuck in place where I have to create rows of drop down lists when the user pressed add more, E.g.: like the ones in mail attachments. I think I have found a way to generate rows, I am not even sure whether it is a correct way, how I generate the rows:
Now when I generate more rows the dropdownlist ids will conflict, so I want to know a way to generate ids, I think I cant even call a function in there.
I was wondering if I had say 10 buttons and I wanted to add them to one event listener, is there a way to set up an array and attach them all to one event listener to cut down on code?
I have a mc with simple btns inside. the mc is on every frame except one,in which I swapped a similar mc (different colors).I have tried leaving the instance name for the mc the same and also changing the instance name to something else but anytime I navigate to that frame, the buttons quit working.I have tried changing both the buttons and mc instance names to no avail.This is on my main timeline:
I load an external swf with some buttons into another swf.Now the buttons have lost their original instance names. A trace reveals their new names to be "button1", "button2", etcetera. If I run the external swf on its own, the same trace displays the original instance names.
So I'm trying to get cute again by building stacks of buttons dynamically, then labeling them from an external text file. The code I have so far is as follows:
[Code]...
But I keep getting the error message: Target not found: Target="undefined" Base="_level0" I'm not sure what this means.
I want to display photos and load them dynamically.What I have is pretty basic .[URL]I have this much done and normally I would just manually add the URL to each button (boring and tedious) and I am learning to import variables and images and all of that...I want to be able to click the thumb to see the actual image:
Main Stage:
code:
onClipEvent(load){ _xscale=1000; _yscale=1000;
[code]...
my problem is that I want to pass a value to the button based on 'i'
That worked but I thought it would be easier to place it in the button.(That didn't work...) I will just use the image mc but my real roblem is passing the value to the button.
code:
on (release){ getURL(strURL+".jpg","_blank"); trace(this._name); }
returns "mc_picGroupA" instead of the button I am clicking.I know its ugly, but I just thought it would be a cool way to display some photos.[URL]
I get the error "Access of undefined property menu_bar" when menu_bar is an instance name directly on the main timeline. I'm not sure how I would call it in the other class. It also isn't exported for actionscript is that the problem?
I have it imported to my document class as:
var mouseClicks:MouseClicks = new MouseClicks(); addChild(mouseClicks);
Very strange. I'm using the following function to pass characters to 2 text input components, but sometimes (and much more often with the "Password" field), after I click a button, the button loses focus and I have to move the mouse to regain the rollover state and be able to click the button again. When I've lost focus, if I click the mouse, it just changes the button to the rollover state but doesn't pass the value...
Here's the code: var Focus:String = ""; function KeyPadButtonClick(_id:Number) { // default the focus to the UserID if (this.Focus == "") { this.Focus = "UserID"; [Code] .....
I've calling file names from an XML document, for example: <file>thisGraphicab.swf</file> Then when I call the graphic, the graphic with the matching file name does not exist, but similar named files do exist. For example: thisGraphicab does not exist but thisGraphicbb does exist. Flash will load the thisGraphicbb.swf file in place of the file actually called.
Is there a way to remedy this? I want flash to fail when the file requested does not exist. When you type the name graphics/thisGraphicab.swf into the browser address bar, the file name is changed by the browser to be thisGraphicbb.swf, and it displays, but here again I need it to fail when something like this happens. I know this seems odd, but there's more to it in the end. Anyway, this is what I need to take care of now.