I'm making a function to be called by different buttons, and I want the function also alter the appearance of the button itself. But I don't know how to refer to the button from within the generic function.
I have a button in an AS 2.0 fla that calls a javascript function like an anchor so the html goes to a set y position of 750button actions are in a frame
jobsLink_mc.onPress = function () { //ExternalInterface.call("scrollPageY"); ///getURL("javascript:scrollPageY();") getURL("javascript: scrolling()") }
Now the javascript in the html of the page is
<script language="javascript"> function scrolling(){ document.body.scrollTop = 750; } </script>
I originally copied the code from a page a designer never finished but the function works. [URL]click the blue button JOBS / INTERNSHIPS you will see the flash button calls the java function and the page is viewed at Y 750 Now I have the same page elements in a different fla that calls the same function and it doesn't work.
I do not want to use external .as files because I will have about 100 swfs to manage in this project, 100 swf is a lot of file management alone without adding 100 .as files on top of it.This is the code in the parent swf file to call the child swf and place it in the page_mc movieclip (note in my final project "child.swf" is replaced with the loading array variable but we're going to keep it simple):
ActionScript Code: var pageLoader:Loader = new Loader(); page_mc.addChild(pageLoader); var loadedpage:URLRequest=new URLRequest("child.swf"); pageLoader.load(loadedpage);
Now just for a simple function to call, we'll say we have a box_mc on the stage in the child swf, and when we click the button in the parent swf I want to call a simple function like this to hide it:
ActionScript Code: function hideBox(event:Event):void { box_mc.visible=false; }
how do I call that function in the child swf from a button in the parent swf?
I am trying to run a function upon a button being clicked. I want that function to call a seperate function outside of the Click function. It tells me it needs an argument but not sure what argument to give.
I have a function set up to stop a timer internal function pauseTiming():void { timer.stop(); } how would I call that function when a button is pressed, say with an instance name PauseTimer? I would also need to call the function startTiming when the button is pressed a second time. (or create two buttons, start and stop).
I'm writing an app where I want to know which, of an unspecified set of buttons, the user is clicking.The actual location of buttons determined by previous user actions, so I cant use information like mouseX.You can see from the code the way I'm attacking this - trying to access the button based on its position in the display list of a container. Unfortunately this has always led to type coercion errors 0 - AS can't see that e.target is a DisplayObject.se has solved this problem.
I have these function which are called when the file is started. However how can I call it when I click a button: function processXML(e:Event):void { myXML = XML(e.target.data); // after this executes you can call getXmlValues(); getXmlValues(nodeId,n,stopAtNumber); } function getXmlValues(nodeId,n,stopAtNumber):void { [Code] .....
How would I do this in AS3? I want to call a function and run it with specific properties depending on which button is clicked.So how do the "_this" statement work in as3? in as2 I would write something like this and "this" would stand for the instance name:
i need some action script for a button to load another swf file when clicked. new window needs to be at the same size as the swf movie and without toolbars etc. also need a similar code to load swf file but to go on a button on a html page.
i'm creating a music app where I have arranged different sounds in xml files. I have 16 buttons on stage that play a sound from my xml file. Is there a way to swap the active xml file at the click of a button for one with different sounds? here is my code so far:
var audioArray:Array = new Array(); var snd:Sound = new Sound(); var sc:SoundChannel = new SoundChannel();
I have many buttons in a few movie files, i need to select a few of these buttons and store them in an array so i use....
var twocolourbuttons:Array = ["mybutton1", "mybutton23", "mybutton34"];
I then need to show a movie file if the button that has been clicked on is in the array. so something like...
if e.target.name is in the array show the movie twocolor.visible = true;
i then need to go to a certain frame of the movie, depending upon where the button is found in the array. So if the button is at position three of the array, i need to jump to keyframe 3 of my movie.
I have 4 navigation button and like home, about us etc.... And i want to disable home when it is click and cannot clicked it until the user click another button first. means if a visitor is at home page then home navigation is disabled, and all other are active, and when they click at aboutus button then the pages goes to the about us page and the about us button is disabled and other get active. I want this solution in AS3 with oop concept.
I've got about 6 buttons laid out, one on top of the other in a list format. In their normal state the buttons are grey in colour, when I rollover them, the buttons flash and turn to orange. Now, what I need to happen is this: I want the buttons to stay orange once clicked and only roll out back to grey when the user has clicked on another button in the list. I've been told that the best way to do this is via adding a listener, however I am a little unsure as to how to go about this. I've checked the flash help file and have a basic understanding of how listeners work...but can't really wrap my head around applying it to this situation. Perhaps I will need to have all the buttons as separate broadcasters?
im using a function that iterates through all nodes in an XML tree, and then calls itself again if any of the nodes it is looking at has a set of child nodes, so in other words it multi-dimensionally loops through the entire XML tree.[code]one question i have is - am i correct in my assumption that while variables declared within a function are not accessible anywhere but within that function, if a function calls itself, any loops within that function that use a variable such as "i" will be affected seeing as "i" is accessible within the function?if so, how do i get around that? currently my function loops through all the way down to last child node it can find along the first branch of the XML tree, but then doesnt continue looping through the other branches.
I have this button: <s:Button includeIn="MeniuPrincipal" label="Descarcare Date" click="downloadLmData(event)"/> And this click event handler: protected function downloadLmData(event:MouseEvent):void { downloadData('competenta', 'competente'); downloadData('localitate', 'localitati'); }
The downloadData function looks like this: private function downloadData(item:String, items:String):void { try { var colVar:String = 'col' + cappitalize(items); this.status = "Descarcare date in curs..."; this[colVar] = null; [Code].....
The problem is, all calls are ignored, except for the first one. Is there any "queuing" mechanism which would allow all calls to be made?
I have a gallery, which has a document class and all classes below.When I load gallery.swf into main timeline currently, how do I call some functions in that document class?
I have several custom functions that I import as .as files, but I frequently have to modify them to suit projects, which makes standardization and version tracking harder.Is there a way to pass arbitrary expressions to a function when it's called? For example, if I write the function,
Code: function foo(){ for(i=1; i<=1; i++){ trace(i); } }
would there be some way to attach an additional expression after the trace function during the function call? As in,
Code:
foo(do_stuff_here);
where the function would act as if it had said,
Code: function foo(){ for(i=1; i<=1; i++){ trace(i);
[code]....
but without modifying the original function?I realize I could add an expression to the original function within a conditional, and toggle it via an argument within the call, but since I don't know what I'll add next, or whether I'll need it next time, this would become impractical quickly.
I'm trying to call an function in flash from xml. so I used <a> tag and asfunction. But how come when it calls a built-in function in flash, it works. and when it calls a custom function, it just won't work???
If I create a function which calls someLoader.loadClip(...) many different times for different clips and files that I have created, does the system create a seperate thread for each call or does it load one by one ?
At work we have a lot of AS3 code that conditionally performs logging or assertions like so:
[Code]...
Is there any way to do something similar in AS3, or do we have to do the conditional compilation blocks around everything? I have been looking around manuals but have found nothing useful yet.
I'm implementing AMF service methods for an flash front-end. Normally things work fine, but we've found that if two methods are called one right after the other, the second call returns null to the flash front-end even though the method actually completes successfully on the PHP end (to verify this, I dump the return data to a file right before I return it).
I am developing a game project, in which I have many functions on it. I have all the major functions on the frame 50. And I don't want these functions on the next frame. Indeed I didn't have these functions on the 51st frame, the 51st frame only contains a stop action. But flash calls all the major function on the 51st frame also, I don't want these function to call on the 51st frame. Is there any way to stop this? Or else my program contains error?
Here is the program... = The 50th Frame = stop(); fscommand("allowscale",false); fscommand("fullscreen",false); var die:Boolean = false; var currGun:String="hd_gun"; [Code] .....