Actionscript getURL function
Hello ActionScripters,
I have a series of html files with embedded flash content.
I have one html file with embedded flash, that always opens a
new browser window
when a button is clicked. I always want the button, when
clicked to open the next html file (along with its embedded flash
file) to open in the same browser window.
I am using Windows XP, Flash 8 (and Flash CS3).
The button is really a movieclip that when clicked calls the
getURL() function. I am using _self as the parameter for the
function as well as the
http://www.myflashpage.com/coolFlash.html
(etc).
I have other html files where the getURL functions correctly,
and opens the next page in the same window.
But there is a difference between these pages. In the page
that does not work, I create an empty movieclip container, and then
attach the movie (in this case the button as a movie clip) to the
container. There is more than one movieclip container. The button
is clickable in the container (I use swapdepth to put container on
top, etc).
On my other html files I do not have the button (a movieclip)
on any layer (aka container) other than the top layer. The button
works fine this way, using _self as the parameter.
Any ideas on how I can get my attachmovie version to work??
Thanks,
eholz1
Hello All,
Thanks for the reply. I have attached some code for the
button, etc.
I have "found" a workaround of sorts (forgetting my lack of
ActionScript codeing know-how).
When I leave the "_self" off the getURL function, I stay with
the same browser window (tested with IE 6).
Thanks,
eholz1
Similar Messages
-
Call actionscript file function from actions panel of a movie clip
i have a movie clip with an actions layer
can i call a function from an actionscript file from the actions panel?does that actionscript file specify a class or not?
if not, then use:
include "yourpath/yourfilename.as"
on any timeline.
any function in that as file will be added to the timeline that has the include statement and you reference that function with normal dot syntax from your calling timeline. -
Hello, i am designing a site in dreamweaver, with a flash
intro screen.
site
www.ciplastering.co.uk
I have added action script to the movie button i have
created, to point to the www.ciplastering.co.uk/home.htm page, but
it does not work. The muroon square you see is the button, and i
have added the getURL funtion ontot he same keyframe as the
rollOVER and rollOUT funtions - any ideas as to why this does not
work ???
thanksactionscript code error.
you have:
onRelease = function ()
getURL("
http://www.ciplastering.co.uk/home.htm");
it needs to be
square_mc.onRelease = function ()
getURL("
http://www.ciplastering.co.uk/home.htm"); -
Calling all Actionscripters!
HELP!
I am new to actionscripting (fairly) and I am stuck.
I am trying to create a series of buttons which scale up to
125% of their size when the mouse is rolled over and scale back
when the mouse rolls out, tweening in between the two states.
I have found some clipEvent scaling but cant seem to make it
work with the buttons.
I have attached the neccessary files for you to check out.
Many thanks to all
Long live CS3! May we all get a copy!
Neilb1969
Download
sample filesi didnt look at ur file, but there are 2 ways to do this.
one, make a movie clip with 2 tweens one that makes it
bigger, and one smaller, put some stop actions on the end of each
tween, and label the frames. make the onRollOver and onRollOut call
those parts of tha tmovie clip. OR my preference, use scripted
tweens.
import mx.transitions.Tween;
import mx.transitions.easing.*;
instance.onRollOver = function() {
var motion:Object = new Tween(instance, "_yscale",
Strong.easeOut, instance._yscale, 125, 1, true);
var motion:Object = new Tween(instance, "_xscale",
Strong.easeOut, instance._xscale, 125, 1, true);
instance.onRollOut = function() {
var motion:Object = new Tween(instance, "_yscale",
Strong.easeOut, instance._yscale, 100, 1, true);
var motion:Object = new Tween(instance, "_xscale",
Strong.easeOut, instance._xscale, 100, 1, true);
} -
Actionscript clock function problem
I have created a clock within flash but when I place it as an button selected object in a timeline it does not function, can anyone help me?
Thanks in anticipation!
You can view swf file here.
My actionscript is as follows:
time_btn.onRelease = function() {
gotoAndPlay("rolex_ani");
var hours = timenow.getHours();
var minutes = timenow.getMinutes();
var seconds = timenow.getSeconds();
var milliseconds = timenow.getMilliseconds();
var date:Number=timenow.getDate();
var day:String=days[timenow.getDay()];
var month:String=months[timenow.getMonth()];
var days:Array=["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var months:Array=["January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December"];
timenow = new Date();
day_txt.text =day;
date_txt.text =date;
month_txt.text=month;
hours_mc._rotation = (hours*30) + (minutes/2);
minutes_mc._rotation = (6 * minutes)+(0.1 * seconds);
seconds_mc._rotation = (0.006 * milliseconds)+(6 * seconds);try the code below. and you should delete the onEnterFrame loop when it's not needed.
time_btn.onRelease = function() {
gotoAndStop("rolex_ani");
this.onEnterFrame=function(){
timenow = new Date()
var hours = timenow.getHours();
var minutes = timenow.getMinutes();
var seconds = timenow.getSeconds();
var milliseconds = timenow.getMilliseconds();
var date:Number=timenow.getDate();
var day:String=days[timenow.getDay()];
var month:String=months[timenow.getMonth()];
var days:Array=["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var months:Array=["January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December"];
day_txt.text =day;
date_txt.text =date;
month_txt.text=month;
hours_mc._rotation = (hours*30) + (minutes/2);
minutes_mc._rotation = (6 * minutes)+(0.1 * seconds);
seconds_mc._rotation = (0.006 * milliseconds)+(6 * seconds); -
Actionscript - Call function from string (callback)
Hopefully this is simple.
I have a function that has a string passed into it. The
string is the name of the function I will need to call a little
later on.
If I have a string that is named after a function how do I
use it to call that function?
Example:
public function someFunction(functionName:String):void
//do whatever
//at this point I need to somehow call the function that is
held in the string functionName
functionName() //obviously this doesn't work, what needs to
happen here?
}If you have access to an instance of the class that the
function is part of, you can do the following:
public function someFunction(fnName:String, inst:Object):void
var fn:Function = inst[fnName];
fn();
If you don't want to deal with functions associated with an
object, you can just pass around standalone anonymous functions:
public function someFunction2(fn:Function) {
fn();
someFunction2( function():void {
trace("Yo");
Hope that helps!
- Peter -
GetURL function - PDF not opening on a PC on first click.
Hi there!
I have a simple Flash button with the following script attached:
on (release) {
getURL("http://URL/sample.pdf", "_new");
And I've also tried this:
on (release) {
getURL("http://URL/sample.pdf", "_blank");
...and my client (Who uses Firefox, on a PC) has to click on the button twice to view the PDF. The first time they click on the button, they have to close the blank window that pops up and then click on the Flash button again to view the PDF. It opens fine the second time. Is this just a PC problem? On my Mac (Safari) it works fine, but (Firefox) seems to want to save the document before I can view it.
Thank you,
CamHi,
The issue does not seem to be with flash instead it is probably the browser settings on how to handle the PDF files.(you can check this by opening the URL directly in your Firefox browser and see how it behaves) It looks like the browser settings for acrobat is different in the Firefox browser you are trying to view. Please go thorough the below link and see if any of the discussions/solutions that help you rectify the problem.
http://www.bnl.gov/itd/webapps/pdf_help.asp
Thanks! -
Hi,
I am trying to work out how or if I can resize a browser
window to a preset size for example 800 x 600. I have an FAQ
application and when the user clicks on video tutorial a swf is
displayed. The swf was made using Captivate and has a resolution of
800 x 600.
At present when you click on the button it displays the
tutorial in a full browser window, which depends on the users
screen resolution. I want to force the new window to open the swf
at 800 x 600 without having to embed the swf into an html page. The
site this app will be loaded onto is content management site and do
not want too many managed files created, which will need to be
maintaining (if I embed the swf to a html page I will need to
upload the swf and the html page). However if I can force the new
browser window to the correct size I will only need to upload the
swf.
Hope I have explained this well enough and I look forward to
any assistance.i guess the SWF has to be in a HTML file or it is not
possible for the browser to "get" any command. i mean with a
javascript in the HTML file when the SWF is embedded you could
resize the browser window, but without HTML, no javascript, no
direct communication with the browser. -
Function - Adobe ActionScript 3 (AS3 ) API Reference
This question was posted in response to the following article: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Function.html
The interface to Function seems like a heavily edited API that was meant for reflection, and that certainly leaves room for improvement. A function with n arguments and a ...rest parameter still yields a length of n. An added Boolean somewhere? And how about the types of the parameters and the return type of the function itself?
-
I am using two buttons with a getURL function. The
actionscript is set to open the url in a new browser window, which
works, however, when I have opened one of the URL's in a new
browser window, the second one opens in that same window, instead
of opening another window. Is there a way around this ? The code I
use is something like this:
forum.btn onRelease = function(){
getURL("url","_blank")
and
webwinkel.btn onRelease = function(){
getURL("url","_blank")
Any help appreciated. T.I.A.Use different window names....
e.g. change the second button to :
webwinkel.btn onRelease = function(){
getURL("url","_blank2")
} -
Actionscript link help...
I've been trying to work with a flash template that I bought
from templatemonster.com ...
Here is my problem...I need the buttons at the top to link to
other pages, whereas currently they link to other scenes or
frames...
Can I do this without losing the interactive actionscript
features (rollover effects, etc.)?
I had it working before when I just added in a bunch of
getURL functions, but it wasn't the prettiest...some of the
rollover effects didn't work correctly...
Here is the current code for one of the buttons:
onClipEvent (load) {
num = 1;
on (rollOver) {
if (_root.link<>num) {
this.gotoAndPlay("s1");
on (releaseOutside, rollOut) {
if (_root.link<>num) {
this.gotoAndPlay("s2");
on (release) {
if (_root.link<>num and _root.animation == 1) {
_root.animation = 0;
_root.link_prev = _root.link;
_parent["item"+_root.link].gotoAndPlay("s2");
_root.link = num;
_root.play();
}you should be using:
onClipEvent (load) {
num = 4;
this.hitArea = this.area;
on (rollOver) {
if (_root.page<>num) {
this.gotoAndPlay("s1");
on (releaseOutside, rollOut) {
if (_root.page<>num) {
this.gotoAndPlay("s2");
on (release) {
if (_root.page<>num) {
_root.page = num; // <-assign before the following code
_parent["item"+_root.page].gotoAndPlay("s2");
getURL("index-3.html"); -
What happened to the Actionscript crutch?
I just upgraded from Flash MX to Flash MX 2004.
The actionscript area is less user friendly than before. I
used to be able to "fill in the blanks" when it came to setting
getURL functions like on release and target blank window. I see the
same problem with the timeline control functions.
Is this crutch gone now, or is it hidden? Why would they make
the program harder for those of us who don't have actionscript
memorized?Mike,
> I just upgraded from Flash MX to Flash MX 2004.
Yup.
> The actionscript area is less user friendly than before.
Heh, I suppose that depends on your comfort level with
programming. To
people who prefer to type their code, it became that much
less cluttered.
But I hear ya. I know what you're missing.
> Is this crutch gone now, or is it hidden?
What you're referring to is called Normal Mode (versus the
Expert Mode
of the Actions panel). It is gone in Flash MX 2004 -- back as
Script Assist
in Flash 8.
> Why would they make the program harder for those of
> us who don't have actionscript memorized?
That, I can't answer. But for what it's worth, you do still
have the
blue "plus" button that enters ActionScript for you, and the
ActionScript
Language Reference is only ever a keystroke away (F1 key).
That may not be
much of a comfort, but if you really think about it, there
isn't a whole lot
to memorize if you're only using ActionScript for basic
navigation like
gotoAndPlay(), getURL(), and the like. The syntax is always
the same, once
you know it. Functions, such as getURL(), are "action words"
-- verbs, if
you will. You can usually spot them by the parentheses. They
do things
based on what you tell them to, and what you tell them goes
into the
parentheses. The expected format -- like, is it a number, is
it a
string? -- is explained in the AS Language Reference. You can
tell at a
glance by the :Number, :String, and so on in the listing, as
well as the
Parameters heading.
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
Should this Simple ActionScript work?
I know nothing about ActionScript. I need to make my banner
ad work so if you click anywhere it takes you to the web site it's
advertising.
I've spent about 3 days looking for tutorials, reading the
help section etc etc and nothing seems to work. The 'action' part
of this did work, as soon as I tested the movie it would load the
web page, but when I try to make it dependent on a mouse click it
never responds.
If anyone could tell me whether the ActionScript should work
or not I'd be very grateful. I don't know whether it's just that I
havent set up the button correctly, or whether there is some other
problem.
This is using ActionScript 3. I've tried using the getURL
too, but when I change the movie to ActionScript 2 I get lots of
errors for commands I know nothing about - presumably related to
Flash's commands it creates for the animation?
It would be really helpful if there was just a 'here's the
code, paste it in and change your button name and URL".
I feel I've wasted far too much time on this already, and I'm
sure that for someone who knows about flash this should be a 2
second job.
import flash.events.MouseEvent;
import flash.events.IEventDispatcher;
var imURL:URLRequest = new URLRequest("
http://www.imaginemontenegro.com/");
function sendtoIM(MouseEvent):void {
navigateToURL(imURL, "_self");
mybutton.addEventListener("MouseEvent.CLICK",sendtoIM);bilbo--baggins,
> I know nothing about ActionScript. I need to make my
banner
> ad work so if you click anywhere it takes you to the web
site
> it's advertising.
Okay. The answer to that is going to depend entirely on the
version of
ActionScript you want to use. If you're publishing to
ActionScript 3.0,
you'll have to publish for Flash Player 9. If you want to
publish to
earlier versions -- arguably a good idea, for a banner ad --
you'll have to
configure your publish settings for ActionScript 2.0 or
lower.
> If anyone could tell me whether the ActionScript should
work
> or not I'd be very grateful. I don't know whether it's
just that I
> havent set up the button correctly, or whether there is
some
> other problem.
Is you code available somewhere? (I'm reading this with a
newsreader,
so it's possible you posted code to the web version of these
forums, and the
code hasn't made it through.)
> This is using ActionScript 3. I've tried using the
getURL too, but
> when I change the movie to ActionScript 2 I get lots of
errors for
> commands I know nothing about - presumably related to
Flash's
> commands it creates for the animation?
The getURL() function has become navigateToURL() in AS3, but
I'm unclear
now what language you're using.
> It would be really helpful if there was just a 'here's
the code, paste
> it in and change your button name and URL".
If you're publishing to AS2, give your button an instance
name in the
Property inspector and make sure that button is a) size as
large as the
whole movie, and b) set on a layers higher than your other
layers. Then, in
a scripts layer (just a layer with nothing in it but code),
type the
following:
buttonInstanceName.onRelease = function():Void {
getURL("
http://www.domain.com/");
... making sure to swap buttonInstanceName with the actual
button's instance
name, and domain.com with the URL of your choosing.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
Calling a function on an object passed as argument
Hi everyone,
i'm trying to call an actionscript function on an object passed as argument to a c function. Here are how I do :
I have a class named test_class implemented as
package
public class test_class
public var bliblou:int;
and a C function that have to modify the bliblou var of an test_class object passed as argument. Here is my function :
static AS3_Val test_obj_param( void* self, AS3_Val args )
AS3_Val obj;
AS3_ArrayValue( args, "AS3ValType ", &obj );
AS3_Set( obj, AS3_String("bliblou"), AS3_Int( 123456 ) );
return AS3_Null();
Then I call the function in my actionscript main function like this :
var loader:CLibInit = new CLibInit;
var lib:Object = loader.init();
var test:test_class = new test_class();
lib.test_obj_param( test );
But when the test_obj_param is trying to run, I obtain an error saying "unable to access a propriety of a null object".
What am I doing wrong ? Is it possible to do what I try to (calling a function on an object passed as argument) ?
Thanks in advanceAfter a long trip to Alchemy possibilities and a lot of tests I have finally found a solution to my question.
Instead of using AS3ArrayValue to get my objet, I use the AS3 function shift on the args array to get my object. Here is how I do
static AS3_Val test_obj_param( void* self, AS3_Val args )
AS3_Val emptyParams = AS3_Array("");
AS3_Val obj = AS3_CallS( "shift", args, emptyParams );
AS3_SetS( obj, "bliblou", AS3_Int( 123456 ) );
AS3_Release(emptyParams);
return AS3_NULL();
Maybe there is a bug in the AS3ValType getter. -
GETURL is not working in flash player 9.0.124.0.
Dear Friends,
My swf and my html are in different domain so i got a issue
in GETURL function , It is not working in flash player 9.0.124.0.
in IE browser so that i add one parameter like allowScriptAccess
=always then its working fine.but my question is what will happed
if they will introduce any new flash version in future please tell
me what is the permanent solution for this issue.
ThanksThere is no way to know what will change in the future. This
is the solution that works now. It will probably remain in place
for the reasonable future.
Maybe you are looking for
-
Message is: Your photo library is either in use by another application or has become unreadable Shut down and restart your computer, and then open iPhoto again. If the problem persists, try rebuilding your photo library. To do this, quit iPhoto, and
-
Difference between EO and VO Transient Attributes
Guys, We do have Transient attributes at EO and VO Level. Are there any difference in that? Can you give me use cases where we need to prefer EO Transient attribute instead of VO Tranisent attribute or Vice versa... Any help appreciated....
-
Keynote 09 files not recognized as "Presentations" by Spotlight
I have folders with various presentations in Powerpoint, Keynote 08 and Keynote 09 formats. I have setup Smart Folders with search criteria that show me these presentations in a single view. I use the search criteria "Kind = Presentations" to narrow
-
Cannot download a .jnlp file
I'm encountering an error while downloading a .jnlp file. Everytime I try to download a .jnlp file it just shows me the source code for the jnlp.
-
Best way to Clone 11i on Linux w/o any Oracle SW on target.
Hi, I have an instance of BS 11.5.10.2 on Linux 4.6 (Single Node) stage. I have another Linux box stage which also has HEAL 4.6 which don't have any kind of oracle software. But both system has same oracle/capping users, file systems, host configurat