ActionScript 3.0 :: Multiple NavigateToURL In Same Function?
Apr 22, 2011Having an issue with having multiple navigateToURL in the same function. Only one seems to fire. Any ideas? Here's the code.URL...
View 3 RepliesHaving an issue with having multiple navigateToURL in the same function. Only one seems to fire. Any ideas? Here's the code.URL...
View 3 RepliesI have a frame based HTML file in which my SWF is displayed in the left frame.My SWF file has a button that simply,when clicked,displays a HTML file in the "rbottom" frame. Following is the code I used:
var a:String;
function aboutmeClicked(evt:MouseEvent):void {
var targetURL:URLRequest = new URLRequest("resume.htm");
navigateToURL(targetURL, "rbottom");
}
aboutmeB.addEventListener(MouseEvent.CLICK,aboutmeClicked);
Unluckily, when the button is clicked at run-time, the "resume.htm" file is opened in a separate window rather than in the specified frame.
I have a flash code, in which i am loading images and opening urls through xml file, now it is opening in a different window(pop up window) but i want it to open in the same window.
var xmlReq:URLRequest = new URLRequest("XML/ImagesData01.xml");
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(xmlReq);
[Code]....
I'm trying to get a couple of buttons to work on my simple Flash slideshow. However, ActionScript 3 is giving me this error:
1126: Function does not have a body.Here is my script:
more_btn.addEventListener(MouseEvent.CLICK,clickHa ndler1);
more2_btn.addEventListener(MouseEvent.CLICK,clickH andler2);
function clickHandler1(event:MouseEvent):void{[code]......
I have created a file that displays Home and Away team names by using an mc that has 2 dynamic text fields "home" and "away". This mc is copied and pasted below the one above and each of these mc's has the following action:
ActionScript Code:
onClipEvent (load) {
gameNo=0;
[Code]....
I can't get this to return the required values.
I have three buttons. My goal is that each button will load and play a sound file from the internet. Here is what I have:
function loadPlaySnd(pSpecifier1:String):void {
arguments;
SoundMixer.stopAll();[code]....
Every Button I press goes to the same sound file. The best I can figure, is that the file I loaded the first time I pressed a button has been uploaded, and from there I cannot load another file over that variable when I try another button.
I have a keyboard which consists of 26 MCs, named keya, keyb, keyc.... and so on.
I want to create a button that will disable all these buttons at once, but I'm not sure how to express it in actionscript. Basically, I need it to say 'on release, key X (where x = all characters from a to z) _enabled= false;
I am building a scrolling image bar, so I've created code that works perfect on one object. However, I need this code to apply to multiple objects at once so that they will move left and right and resize independently from each other (to give this sort of 3d revolving look). Other boxes will be to left and right of the current black box. Code is below as well as link.
Code:
function mousetracker(object){
boxstartx=object._x;
boxstartwidth=object._width;
[code]....
I have a .fla project being created under CS4, using ActionScript 3.0, that consists of multiple scenes.
In the code attached to the first scene, I define some functions that are used as methods on buttons[code]...
I have a group of 50 buttons (named Bottle01 > Bottle50) that I want to have the same code on. The code I want is to, when pressed, put the buttons individual name into a variable and then move to a point later in the timeline. I have just started using as3 as I need this to work through Air and have been googling all afternoo and have cobbled something together, but it doesn't seem to work that well. This is the code I have sofar which is probably very wrong:
[Code]...
I'm building a menu for a website that plays a sound each time you mouse over one of the buttons. (each button is a piano key) I've written two functions that change the size of each key on ROLL_OVER and ROLL_OUT events. What I want is someway to play a unique sound in my library for each key, without writing a separate function for each key. Either a new function, or just written into my existing ROLL_OVER function. Currently, it plays the same sound for every key.
Here is a zip of my project
[URL]
What I've got in there is a fla file called menu.fla In that file there is a movieclip on stage called "keyboardmenu" and inside that movieclip are 8 movieclip's (my buttons) each with a unique instance name. In the library there are 8 mp3 files with class name keysound1, keysound2 etc...Here is my code: ( I'm using tweener to handle the scaling. )
Code:
import caurina.transitions.Tweener;
function keyisdown(e:MouseEvent):void{
Tweener.addTween(e.currentTarget,{height:185, width:80, time:.25, transition:"easeOutBounce"});
varsound1.play();
[code]....
I've got one function that I'm running, but I need it to run at different times for different movie clips.Here's my code. What is wrong with this?
ActionScript Code:
function tweenText(_TEXT:MovieClip, _START:Number, _END:Number, _SEC:Number, _INTERVAL:Number) {
var xTween:Tween = new Tween(_TEXT, "_x", Strong.easeOut, _START, _END, _SEC, true);
clearInterval(_INTERVAL);
[code]....
I have 1 button (instanced : but)and 3 movie clips (instanced : mc_test, mc_clip, mc_example)when I release the but, I'd like 2 clips to move down (200px) and 1 clip to move up (200px)I'd like it to look like that
Code: Select allfunction down():Void {
_y=_y + 200;
};
[code].....
embarrassed to ask becasue i know its gonna be something simple i over looked. This is what im trying to do i have a movie clip that i want to use as a home button and i want this clip to be on every frame of the movie. well i created a function that whenever this clip is clicked it returns you to the second frame of the movie. now i declared the function on frame 2 when i try and call it from frame three it gives me a 1084 error. Is it even possible to call a function like that from a different frame? This is the actionscript i have in frame 2
stop();
home_btn.addEventListener(MouseEvent.CLICK,homeClick);
about_btn.addEventListener(MouseEvent.CLICK,aboutClick);
[code]........
I am building an interactive world map, and for ease of updating am slapping all the functions in a frame on the main timeline.
Say I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?
My code looks something like this:
buttons.belgium.onPress = function(){
map:scale_target = "250";
map_target = "-1050";
map:y_target = "-280";
[code]....
So can I apply it to my completly separate button with the path map.europe.belgium as well, without having to write out all that crap again for each, when they execute the same things?
i have 4 movieclips on stage and i want to apply a drag function for each separately but i was wondering if there's a way to make this simple. and not to write a function for all 4 movieclips.
View 2 RepliesSay I have a the word "Belgium" with a generic button symbol underneith it (instance name of Belgium of course), and also the maps shape of Belgium, as a button labeled, say Belgium_Map , each requiring several functions for rollovers, movement etc, is it possible to simple write one expresion and apply it to both buttons?Im sure, like most things that one gets stumped on, it is pretty simple, however Im not sure of the syntax..My code looks something like this:
buttons.belgium.onPress = function(){
map:scale_target = "250";
map_target = "-1050";
[code]......
I'm trying to make this script work in which two things should happen onRlease of a movie clip. In the script below, the "transition" plays but frame 18 doesn't..even though the path is right. I even tried frame label even that doesn't work. The script is on the clip itself.
_root.navbtns_mc.webnav.onRelease = function() {
_root.transMC.gotoAndPlay("transition");
_root.navbtns_mc.webnav.gotoAndStop(18);
}
I'm building a demo that has a keyboard in it. Obviously, people will type stuff with it and it will go into a dynamic text field. So I have a full keyboard (a movie clip named "keyboardStandard") made up of button symbols. That is placed in the same frame as the text field. Then I wrote this code, using the Q key ("keyQ"):
Code:
keyboardStandard.keyQ.addEventListener(MouseEvent.CLICK, addQ);
function addQ(ev):void {
enterPlayerID_txt.appendText("Q");
}
This works just fine, the Q goes into the text field. However, I sure as heck don't want to write 26 event listeners, then 26 more functions, even if it is copy paste. That's just gnarly. Plus, there are actually 3 keyboards - a numeric and special char one as well I need to handle.I seems passing a parameter from the event listener is not doable?
lets say I define a function that does a simple trace of the arguments it takes in, now is it possible to have multiple arguments? like sometimes i want to send in a String argument, sometimes a Number, and sometimes an Array.Do I need to create the same function 3 times to accommodate for the 3 different inputs or is there a way I can keep one function but send one of the 3 values.
View 3 RepliesIs if i have a textbox, name_txt, i can clear it with a function[code]....
which is great, but i don't just have one textbox. i have lastName_txt, age_txt, etc. how can i reuse my one function for multiple textboxes?
How can I get a function triggered by multiple triggers? For example, a function that is normally triggered by a condition but also needs to be executable independently with a mouse click.
View 3 RepliesI'm trying to code a variable rollover for a sequence of MCs on the stage. I have 3 buttons (MovieClips) on the stage and each time one is rolled over I'm making a different movieclip appear.
So I've done this in a root timeline frame script:
//put an empty container movieclip on the stage
containerMC = _root.createEmptyMovieClip("container", this.getNextHighestDepth());
//button 1 - "but1" is my linked instance name and Content 1 is my content movieclip
[Code].....
and so on for each button (1, 2 and 3). As you can imagine if there were 20 buttons there is a lot of uneccessary duplication.
What I've considered is, as they are sequential I should be able to read "but"+i and "content"+i and I could push the button names and content names into an array. The thing I'm having trouble with is, how do I write the function so it checks which clip is rolled over and then attaches the corresponding content movieclip?
Ultimately I would like the script to check how many buttons there are on the stage and simply iterate for that number (so I don't have to specify how many there are to loop through i.e. numOfButtons = 4), But not sure how to go about it.
As you can see the code could be the same for each button, if I could read the movieclip rolled over and attach the function variably.
In summary what I'm trying to do is have a single function for all rollover buttons named but1 to but n.
As seen below, I tried to return more then one variable from a function but , I think I have some syntax problem..
function hesapla3(parametre1,parametre2):(Number&&Boolean) // PROBLEM IS HERE, I NEED TWO VARIABLES TO RETURN{var yenideger2:Number=new Number();var bol2:Boolean=new Boolean();yenideger2=parametre1+parametre2;if(yenideger2>80){bol2=false;}return yenideger2;return bol2;trace(yenideger2);trace(bol2);}
My problem is that I am trying to use the following functions on 10 different logo movieclips. Each logo movieclip has a popup up box (another mc) within its timeline with a description in. When I hover over the logo movieclip i want it to call the forward frames function and on hover out call the rewindframes function.
function forwardFrames() {
onEnterFrame = function () {
if (_currentframe != 15) {
nextFrame();
[code]....
Got 9 MCs which I want a rollover effect for. I made 1, copied it and it's instance name 9 times. And made this script:
Code:
function menu_btn_over() {
myTween = new mx.transitions.Tween(_root.main.menu.btn.btn_parent, "_x", mx.transitions.easing.Strong.easeOut, _root.main.menu.btn.btn_parent._x, 0, inspeed);
[code]...
But it only works for one of the buttons. The one I made the copies from.I figured you could do this since it's the same MC? I could be wrong though. If that is the case, is there some way I can make the same action for every button without having to make a bunch of calls for each one? for example:
"_root.main.menu.btn1 <and> btn2 <and> btn3 <and> etc.onRollOut = function() {"
i got a basic problem with loading a Bitmap from a URLRequest.The problem is, that loading a Bitmap is to much code to write it every time I want to load an Image. So i thought about some function:
var bitmap1:Bitmap = bitmapForURL("test1.gif");
var bitmap2:Bitmap = bitmapForURL("test2.gif");
function bitmapForURL(url:String):Bitmap
[code]......
I'm pulling info from an XML file... there are three variables (year, month, day) that I need to process further in another function, but I can't figure out how to send them out of the function and into the next for processing.
Is it possible to make their values globally accessible?[code]...
I've got this on the timeline of an MC:
_root.seQ1MC.b_seQ1yes.onRelease = function(){
tickVar = _name;
//trace("local tickVar = " + tickVar);
//trace("this tickVar value = " + _root[tickVar]);
[code]....
I want it to act on all the instances of the movieclip it is contained within. It is only acting upon the last of the instances that was loaded or had focus... I'm clearly missing something or am trying to achieve something that isn't capable of working...
I have 16 movieclips, each with different instances and linking to htmlsI owuld like to have it so that when you ROLL_OVER a movieclip, they shift position 1 along the x and 2 along y axis.I've given each MC a ROLL_OVER event listener and know I could call separate function for each but I'm sure there's an easier way.This is what I have already have
Mc1.addEventListener(MouseEvent.CLICK, go1);
Mc1.addEventListener(MouseEvent.MOUSE_OVER, nudge);
Mc2.addEventListener(MouseEvent.CLICK, go2);
[code]......