ActionScript 3.0 :: Calling Another HTML / Flash With Button Event
Jan 22, 2009
I have created a flash movie with buttons. I intended for the user to press these button and open another flash movie or another html. I tried using URLRequest as such below but I got some errors when I run the flash and press the button:
function callSeries(evt:Event):void{
URLRequest("series.html");
}
Error:
TypeError: Error #1034: Type Coercion failed: cannot convert "series.html" to flash.net.URLRequest.
at mainmenu_fla::MainTimeline/callSeries()
Is this method wrong? How shall I call another html or refreshed a current flash movie embedded within a html with another new flash movie. Is this possible?
View 4 Replies
Similar Posts:
Jul 26, 2011
I have a situation where I'm calling a function with an event listener attached to a button, which in turn calls a function, which does a number things including calling a second function which resides in a child swf.
Just as an example:
Code:
myBtn.addEventListener(MouseEvent.CLICK, firstFunction);
function firstFunction(e:MouseEvent):void{
//I call another function in here (among other things)
externalSwf.stopTimer();
}
"StopTimer" resides in an external swf which for our purposes is called externalSwf and it resets a running timer.
Code:
function stopTimer():void{
myTimer.reset();
}
I'm getting argument mismatch errors, which often have to do with the Event Objects not matching. The event object for firstFunction is a mouse event triggered by a click so I put in e:MouseEvent...what I don't clearly understand is, what type of object event is dispatched when I call the function stopTimer from inside the function firstFunction?
View 6 Replies
Feb 22, 2010
how to call a flash function from an HTML page. The idea is to have a link on my page (HTML link) that once clicked displays a movieclip in flash. I know i have to use the asfunction in HTML. So far I have just created my swf file with a function called showInfo. I've embedded the flash into an HTML page. I have then added a link on the HTML page as follows:
<a href="asfunction:showInfo">Link name</a> but when I click it says: "Firefox doesn't know how to open this address, because the protocol (asfunction) isn't associated with any program."
is there a piece of code I need to write in flash for this to work?
View 1 Replies
Apr 5, 2011
I get an error when running my Flash exe file and calling a local html file. I know this is related to Security but not sure the proper way to allow local html files to run or called within my Flash exe.
View 4 Replies
Jul 13, 2009
I am writing a program that needs to go to a random frame after clicking a button. However, the program also needs to start on a random frame. When I call the function at the start of the program it gives me an 1120: Access of undefined property event error. The function is originally written as followed:
function randomMatchedTrial(event:MouseEvent) {
... lots of code that probably doesnt matter, but let me know if it does...
}
the program starts by calling the function as followed:
randomMatchedTrial(event)
Can event handler functions be called outside of the event listeners they are handling?
View 4 Replies
Sep 16, 2010
in actionscript 2.0, one could call a mouseEvent function without actually having that event. For instance:
[Code]...
In this example, of course, rollOutHandler only does one thing, but this function could contain lots and lots of code, and I would not want to repeat all of it again inside the clickHandler function.
View 3 Replies
Sep 30, 2003
I can't get this to work. I need to call a Javascript function from a button in flash. The code is as follows:
on (release) {
getURL("javascript:nameOfMyFunction('whatever.html ')");
}
This is working, so I got the call right. But what I really want to do is have that url (html) to be a variable within flash.
on (release) {
Myurl="[URL]";
getURL("javascript:nameOfMyFunction('Myurl')");
}
This doesn't work. How do you use a flash variable as a javascript function parameter?
View 1 Replies
Sep 20, 2009
hopefully this is possible:
-1 large html (home.html) file houses 2 html files (aaa.html and bbb.html)
-aaa.html consists of 1 swf button
-bbb.html is empty
question: is it possible to click on the button in aaa.html and have the action occur in bbb.html? (for example, clicking the button in aaa.html will load a swf in bbb.html)
View 2 Replies
Mar 17, 2009
is it possible to call a simple HTML file or use iFrame in Flash?
View 5 Replies
Jan 31, 2011
I am working on a little video gallery sort of app. The list of videos to be played is in html. my player is in flash. I need to have my flash player receive the video url and then play it. I can pass vars to flash no prob using swfobject or params. but I need a event listener for to be triggered when a new var is passed.
View 2 Replies
Jun 22, 2011
I'm using SWFWheel to get the mousewheel events in actionscript 3, and I have a small flash window amongst a full html page that needs a scrollbar. The flash scrolls properly, but the whole HTML page scrolls with it. How can I disable scroll to html when over the flash?
View 2 Replies
Mar 18, 2009
Im trying to get 10 year old flash sites all linked togther and online after a long time out of the game for a job aplication deadline.
I just need my path sorting.All I need is the action scripting code to call an html document, that is in a folder within the root. I am calling from a swf embeded in html in the root. I can get a new widdow open but it doesnt find the html file.
Im using
on (release) {
getURL("/Memory/home.html", "_blank");
}
It works in html below,
<a href="Memory/home.html" target="_blank">
how do I write it in actionscript.
View 4 Replies
May 14, 2011
So my team's project has an swf embedded in JavaScript, we're actually using java servlet's to create the html/JavaScript. I am attempting to use as3's ExternalInterface to add a callback which would get called in the javascript but everything I have tried will not work.[code]so if there is a missing tag or something that's probably not my problem. NOTE I embed this correctly and get into the swf allowing it to call javascript functions(as3 calls the getStuff fn), using the ExternalInterface, which works but JS->as3 does NOT work ='I cant use the movie object for anything (the return value of getFlashMovie), if I try to use no code after works.The action script code calls the external interface addCallback function correctly(called in a try catch that's how I know)[code]The only things I can think of;
1) The embed code isnt creating the object correctly, since I cant use the movie for anything
2) my swf is being created weird and doesnt allow script access.We are using FlashBuilder to build the swf.
View 1 Replies
Feb 5, 2009
I have a problem trying to call a page without it opening up a new tab. Was wondering what is the equivalent of the following command (I was told that this is AS2.0 command).
getURL('option1.html', '_self');
I tried the command below but it open option1.html in a new tab.
function callxyz(evt:Event):void{
navigateToURL (new URLRequest:"option1.html"));
}
View 1 Replies
Aug 7, 2009
I have made an event listener:text0_mc.addEventListener(MouseEvent.CLICK, showMe);showMe is a function, but I need it to call more than 1 function at once i.e. -ext0_mc.addEventListener(MouseEvent.CLICK, showMe1, showMe2, showMe3, showMe4, showMe5, showMe6, showMe7);Each function contains an if statment as below.
function showMe1(event:MouseEvent):void
{
if (shuffledArray[1]==orderArray[1]){
[code].....
View 1 Replies
Dec 26, 2011
I know that I've done this before, but I can't seem to remember tonight. I want to fire a function after a tween is finished.
buttonArea_mc.buttonMode = true;
buttonArea_mc.useHandCursor = true;
buttonArea_mc.alpha = 1;
[Code].....
View 3 Replies
Jan 24, 2009
Does anyone know how to call a function setup to accept an event argument without triggering it through the event?
Example... I have a button with a CLICK event. When you click on the button, the associated function is executed. Now say I want to call that function from within another function. Is there a way to "send" the event information manually?
Right now I have the CLICK function simply call another function that would then be available to be called from any other location. Below is a code example of what I am trying to accomplish.
Code: Select allbutton.addEventListener(MouseEvent.CLICK, doButtonClick);
function doButtonClick(e:MouseEvent):void
{
[Code].....
View 10 Replies
Aug 13, 2009
Typically when you set an event handler function for buttons by code, like:
mybutton.onPress = function(){
trace("Hello!");
}
[Code].....
is that event function accessible from code? how? I know there would be a property that you can access it by, maybe we can "decompile" an SWF to check out finally which property it stores the event code
mybutton.onPress(); // This does not work!
View 1 Replies
Aug 2, 2011
My code is
try {
if (MovieClip(this.parent)!=null) {
if (MovieClip(this.parent).imagename!=null) {
var t=MovieClip(this.parent).imagename;
var url:URLRequest=new URLRequest(t);
[Code] .....
My loader unload event not calling?
View 3 Replies
Jan 10, 2011
I just started a course that does a little flash. To teach us they have us build a brick breaker game. I have come to a part were I have to remove all the Listener that were created for the game. Each level is a movie clip and when the level is over the level instance is removed from the child. From what I understand when the level is removed the Event.REMOVED_FROM_STAGE becomes true and the function attached should be called however it is not. Here is the code of the function that sets the listener and the function to be called:
[Code]...
View 6 Replies
Aug 2, 2011
here my code
----------------------------------------------------
if (MovieClip(root).gmapimage!="") {
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, onLoaderReady);
myLoader.contentLoaderInfo.removeEventListener(Eve nt.UNLOAD,unloadHandler);
var fileRequest:URLRequest=new URLRequest(MovieClip(root).gmapimage);
[Code].....
i want to remove all object and variable set or remove on Event.UNLOAD event(see my function unloadHandler()) but UNLOAD event not work for me anything wrong...
View 3 Replies
Aug 13, 2009
Typically when you set an event handler function for buttons by code, like:
Code:
mybutton.onPress = function(){
trace("Hello!");
}
[Code]....
is that event function accessible from code? how? I know there would be a property that you can access it by, maybe we can "decompile" an SWF to check out finally which property it stores the event code in
Code:
mybutton.onPress(); // This does not work!
View 2 Replies
Mar 16, 2011
I need to create a java/html button that, when pressed, queues my flash animation to begin. I believe I understand how it works on the AS3/ExternalInterface end, but I am unable to test it as I do not know how to properly code something to test it with on the Javascript end.
View 2 Replies
Oct 1, 2009
i have this button in html page "start.html" code :
<html>
<form method="post">
<input type="submit" value="enter">
</form>
</html>
contain normal html button , when i press the button i well redirected to the erea beyond that page
i creat flash button in sthe ame page , just need the action script code to make this button have the same function of the normal button
its mean the variable transfer from the html to swf and the revers , or if you have another simple solution
View 4 Replies
Oct 28, 2010
I have a sprite menu which populates a dynamic textfield with textlabels as users click individual items in the menu in addition to ordinary actions(gotoAndStop). As these labels appear in the textfield, I want to be able to link them to the frames assosciated with the menu - item frames. As you can understand from this, I am working with the timeline. By enabling html rendering of text in the textfield, I have been able to link these output labels via a a href - tag, but I am not able to call a function from this html. The function I am trying to call uses a switch statement to take the appropriate actions according to which label is being clicked, but the only effect I get is the html opening a browser window...... Unfortunately I do not know how to explain this any better, but here is my code for the following:
[Code]....
View 2 Replies
Oct 29, 2010
Tried several approaches for making this happen, but can't seem to do it. I could really use an example of how to do this in my particular case, since I'm not exactly a code - guru..... I have a sprite menu which populates a dynamic textfield with textlabels as users click individual items in the menu in addition to ordinary actions(gotoAndStop). As these labels appear in the textfield, I want to be able to link them to the frames assosciated with the menu - item frames. As you can understand from this, I am working with the timeline.
By enabling html rendering of text in the textfield, I have been able to link these output labels via a a href - tag, but I am not able to call a function from this html. The function I am trying to call uses a switch statement to take the appropriate actions according to which label is being clicked, but the only effect I get is the html opening a browser window...... Unfortunately I do not know how to explain this any better, but here is my code for the following:
Main Timeline, frame 1, actions layer:
ActionScript Code:
import flash.display.*;
import flash.events.*;
import flash.display.Stage;
var buttonTrace:TextField;
var sectionNames:Array = new Array("Frontpage","Introduction",
[Code] .....
View 0 Replies
Jun 10, 2011
I have the code:
var timer:Timer = new Timer(milliseconds, repititions);
timer.addEventListener(TimerEvent.TIMER, callback);
timer.start();
and if a user click I want to call the callback early. Is there was a way to either force the timer to finish immediately, or stop it and send the TimerEvent.Timer on my own?
I'm looking for something simple like the tween classes fforward().
EDIT
The Solution was
timer.dispatchEvent(new TimerEvent(TimerEvent.TIMER));
I was trying to do timer.dispatchEvent(new TimerEvent("TIMER")); which doesn't work.
View 3 Replies
Sep 17, 2010
in actionscript 2.0, one could call a mouseEvent function without actually having that event. For instance:
btn1.onRollOut = function(){
this. gotoAndPlay("out");
}
[code]......
View 6 Replies
Jan 29, 2012
I've been having a problem with multiple event listeners calling the same function (this is just a snippet of the code):
ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_UP,Stop_Scale,false,0,true);
stage.addEventListener(Event.MOUSE_LEAVE,Stop_Scale,false,0,true);
[code]......
View 8 Replies
Sep 21, 2009
I have a flash movie within it quite a few scenes. When I go to a certain scene it has a movie clip on it (UGFT_MC). Within this I have a dynamic text box (UGFTtxt). I have the render text as HTML selected and the variable called "data". On my main timeline at the start of this scene I have the actionscript: loadVariables("UGFT.txt","_root.UGFT_MC");
Within my text file I have the following:
data=<B>All the code I want in my text box</B>
<p><img src="test.jpg"</p> etc.
This part all works, except I have lots of text and images in the text file and need a scroll bar on my dynamic text box. I have tried the UIScrollBar and it only works some of the time, and there is no pattern as to whether the scroll bar will appear. Quite often it is just a grey area. Though the top of the text called from the file is visible.
View 0 Replies