Converting external link as2 script to as3
Hello.
I used this script I found online to make a Flash file that accessed an external text file full of hyperlinks through buttons in the Flash movie. The code is as2. I had to update the Flash file to AS3 and now the script doesn't work. I can't figure out how to do the same thing that this script does in AS3. Can anyone help me?
Here is the AS2 script:
textFile = new LoadVars()
textFile.onLoad = function(){
buttonlink1 = this.BlackBooklink;
buttonlink2 = this.Ashtraylink;
buttonlink3 = this.bedroomlink;
buttonlink4 = this.tvlink;
buttonlink5 = this.spiderlink;
buttonlink6 = this.Mirrorlink;
buttonlink7 = this.Boomboxlink;
buttonlink8 = this.Suitlink;
buttonlink9 = this.cashlink;
buttonlink10 = this.fastfoodlink;
buttonlink11 = this.Idolatrylink;
buttonlink12 = this.Trashlink;
textFile.load("LeftHouseLinks.txt");
//---buttons
BlackBook.onRelease = function(){
getURL(buttonlink1, "_self");
Ashtray.onRelease = function(){
getURL(buttonlink2, "_self");
bedroom.onRelease = function(){
getURL(buttonlink3, "_self");
tv.onRelease = function(){
getURL(buttonlink4, "_self");
spider.onRelease = function(){
getURL(buttonlink5, "_self");
Mirror.onRelease = function(){
getURL(buttonlink6, "_self");
Boombox.onRelease = function(){
getURL(buttonlink7, "_self");
Suit.onRelease = function(){
getURL(buttonlink8, "_self");
cash.onRelease = function(){
getURL(buttonlink9, "_self");
fastfood.onRelease = function(){
getURL(buttonlink10, "_self");
idolatry.onRelease = function(){
getURL(buttonlink11, "_self");
trashtalk.onRelease = function(){
getURL(buttonlink11, "_s
This is the external .txt file content
&BlackBooklink=http://www.yahoo.com
&Ashtraylink=http://www.google.com
&bedroomlink=http://www.yahoo.com
&tvlink=http://www.google.com
&spiderlink=http://www.yahoo.com
&Mirrorlink=http://www.google.com
&Boomboxlink=http://www.yahoo.com
&Suitlink=http://www.google.com
&cashlink=http://www.yahoo.com
&fastfoodlink=http://www.google.com
&Idolatrylink=http://www.yahoo.com
I know how to make AS3 button work, I just don't know the code so that when I click the button, it accesses the external file and goes to the hyperlink specified by the button.
Any help would be much appreciated.
-Shawn
Hi Ned.
I have officially lost the rest of what's left of my hair over this.
Here is the code I am using now. For whatever reason the variable
buttonlink1 I have set up is not being recognized:
var myTextLoader:URLLoader = new URLLoader();
myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void {
trace(e.target.data);
var buttonlink1;
buttonlink1 = this.BlackBooklink;
myTextLoader.load(new URLRequest("LeftHouseLinks.txt"));
BlackBook.addEventListener ( MouseEvent.CLICK, myBlackBookHandler )
function myBlackBookHandler( evt ){
navigateToURL(new URLRequest(buttonlink1), "_self");
This is the resulting error message and below that is the text of the
external text file which is loading into Flash:
Any ideas? Thanks.
-Shawn
TypeError: Error #2007: Parameter url must be non-null.
at global/flash.net::navigateToURL()
at SoulDecisions07_fla::MainTimeline/myBlackBookHandler()
&BlackBooklink=http://www.yahoo.com
&Ashtraylink=http://www.google.com
&bedroomlink=http://www.yahoo.com
&tvlink=http://www.google.com
&spiderlink=http://www.yahoo.com
&Mirrorlink=http://www.google.com
&Boomboxlink=http://www.yahoo.com
&Suitlink=http://www.google.com
&cashlink=http://www.yahoo.com
&fastfoodlink=http://www.google.com
&Idolatrylink=http://www.yahoo.com
&BlackBooklink=http://www.yahoo.com
&Ashtraylink=http://www.google.com
&bedroomlink=http://www.yahoo.com
&tvlink=http://www.google.com
&spiderlink=http://www.yahoo.com
&Mirrorlink=http://www.google.com
&Boomboxlink=http://www.yahoo.com
&Suitlink=http://www.google.com
&cashlink=http://www.yahoo.com
&fastfoodlink=http://www.google.com
&Idolatrylink=http://www.yahoo.com
&BlackBooklink=http://www.yahoo.com
&Ashtraylink=http://www.google.com
&bedroomlink=http://www.yahoo.com
&tvlink=http://www.google.com
&spiderlink=http://www.yahoo.com
&Mirrorlink=http://www.google.com
&Boomboxlink=http://www.yahoo.com
&Suitlink=http://www.google.com
Similar Messages
-
Help! Convert simple Flash AS2 code to AS3
Hi everyone,
I'm a Flash beginner and followed a tutorial: http://www.webwasp.co.uk/tutorials/018/tutorial.php ... to learn how to make a "live paint/draw" effect. I didn't realize that if I made something in AS2, I wouldn't be able to embed it (and have it work) into my root AS3 file, where I've got a bunch of other stuff going on. I've tried following tips on how to change AS2 code to AS3, but it just doesn't work. I know it's simple code, and that some genius out there can figure it out, but I'm at a loss. Please help!
Here's the AS2 code:
_root.createEmptyMovieClip("myLine", 0);
_root.onMouseDown = function() {
myLine.moveTo(_xmouse, _ymouse);
ranWidth = Math.round((Math.random() * 10)+2);
myLine.lineStyle(ranWidth, 0xff0000, 100);
_root.onMouseMove = function() {
myLine.lineTo(_xmouse, _ymouse);
_root.onMouseUp = function() {
_root.onMouseMove = noLine;
Thanks in advance!
Signed,
Nicolle
Flash DesperadoConsidering the code is on timeline:
var myLine:Sprite = new Sprite();
addChild(myLine);
var g:Graphics = myLine.graphics;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
function onMouseDown(e:MouseEvent):void {
var ranWidth:Number = Math.round((Math.random() * 10) + 2);
g.clear();
g.lineStyle(ranWidth, 0xFF0000, 1);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
function onMouseMove(e:MouseEvent):void {
g.lineTo(mouseX, mouseY);
function onMouseUp(e:MouseEvent):void {
removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); -
Dummy Guide needed for converting AS2 code into AS3
I have to convert my existing AS2 code into AS3, but I might as well be reading chinese. I never even began to learn AS3, it was still fairly new at the time and the class ended before we had an opportunity to even touch on it. My major was not web design, it was the print side of design. I took an additional class, after I graduated, to learn web design and our teacher told us, basically, that we were designers, not coders so we won't be getting much into actionscripting, beyond the basics. At the time I was relieved, but looking back, I really wish we would have gotten more into it. Bottom line, I need to learn now.
Is there ANYONE that can help me out? I will list my code below, buy I am way beyond lost any help that can be provided, I would be so grateful!!!!
On the main timeline I have the basic..
stop(); -- I found the AS3 version, but I don't know what I'm looking at. I get "not_yet_set.stop()" and there are are 8 options I can choose from. I just want the timeline to stop until I tell it where to go next. And what is "not_yet_set"
Then I have my buttons, which are, basically...
on (release) {
gotoAndStop("Home");
Or "gotoAndPlay("Whatever");"
I also have buttons for scrolling...
on (press) {
play();
on (release) {
stop();
AND
on (press) {
_root.AboutMe_Controller.gotoAndPlay(…
on (release) {
_root.AboutMe_Controller.gotoAndStop(…
For the on(release) command, this is what I found as the AS3 version: not_set_yet.dispatchEvent()because that's really as1 code, you have steeper learning curve than going from as2 to as3.
first, remove all code from objects, assign instance names to your buttons and you can then start on as3:
// so, if you name your home button, home_btn:
home_btn.addEventListener(MouseEvent.CLICK,homeF);
function homeF(e:MouseEvent):void{
gotoAndStop("Home");
p.s. the not_yet_set stuff is there because you tried to use script assist or some other actionscript shortcut. -
I want to put the adsense banner code in to an external linking page to run in my html dreamweaver page.
I have tried using it in a .js external link but does not read!!!
Has anyone got an idea how I can do this?
This is the code I want to external link?
<script type="text/javascript">
<!-- google_ad_client = "pub0000000000000"; /* 160x600, created 10/14/09 */ google_ad_slot = "0000000000"; google_ad_width = 160; google_ad_height = 600; //-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
Gary503 indicates service unavailable. Do you have proxy settings for internet connection? Or Your instance had some issue at that point of time. Check logs to see what was happening at that point of time.
-
I have a swf (written in AS3) that loads other swfs into it.
There are no issues when loading other AS3 swfs but there is a
problem loading AS2 swfs. I get the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::AVM1Movie@35d3a51 to flash.display.MovieClip.
Is there any way to convert the AS2 swf into a AS3 swf so it
will be compatible with my loader? I cannot go back and change the
AS2 swfs because I do not have the fla files. Or is there any way
to incorporate AS3 code that will load AS2 swfs properly? It seems
hard to believe that Adobe would neglect this backwards
compatibility issue. ThanksHello Andrei1,
Thanks for looking at my simple AS3 code. The AS2 swfs that
I've been working (and having difficulties) with are components
that I've purchased from places like www.flashden.com. Some are
image transitions (such as "Dynamic Image Draw found at
http://www.flashden.net/item/dynamic-image-draw/7532)
while another is used to create a looped banner rotator animation
(IMG_loop, a free d/l from www.afcomponents.net). I have another
that uses an .xml file to configure a slideshow animation.
You mention "needing to do more" if AS2 scripts inside its
swf are to be run by the parent AS3 fla; what would these lines of
code be?
In researching my problem further I've since realized that
most of these issues deal both with the version of AS used, as well
as the version of the Flash player the fla is set up to animate
for. In particular, the "Dynamic Image Draw" component requires
that Flash Player 8 or 9 be used with AS2.
Given that many of my purchased components are like this,
I've since changed my main fla movie from AS3 back to AS2 and have
learned that the scripting needed to call individual multiple swfs
into it at various points in the timeline is MUCH simpler!!!!! One
single, easily interpreted, line of code vs. 5 lines using
variables and much more arcane (to me) function calls.
I started my file with AS3 figuring that I'd be better off
learning the new version of the language; much stress and
forehead-rubbing later, I've seen just how much easier and
understandable AS2 is to learn.
I recognize that there are likely very strong arguments for
the more structured coding approach used by AS3, but for someone
like me who wants to generate customized Flash presentations with
little fuss, I'm not qualified to make them.
Perhaps this is a no brainer for those many flash gurus out
there, but for me this tiny bit of wisdom has been hard fought for!
That being said, is there an easy way to convert a swf file
created using AS2 to something that AS3 can work/interact with?
I've come across a free d/l product called actionscript bridge, but
haven't been able to understand how to get it to work. -
External links in TOC not opening in separate instance of IE after convert to RH7
We converted our FlashHelp project from RoboHelp 6 to
RoboHelp 7. External links in table of contents were set in the
Advance tab to open in a New Window. This worked fine in RH5 and
RH6 but when converted to RH7, the external link opens in the topic
pane.
Links within topics that link out to external web pages or
documents are set to open in New Window and these work fine.
Why would the Advance option for New Window work differently
as a hyperlink in a topic vs. a link from the table of content? How
do I fix this? Don't see any documentation in help system.fixed via in one of the releases to RH7
-
Converting Flash Remoting AS2 to AS3
Hello
I was wondering if someone could direct me to some tutorials
on Flash Remoting for AS3.
I would like to convert my old AS2 code over but I can't find
any information on that.
Does this functionality still exist for AS3?
AdamSee
http://ssr.riaforge.org/ -
External links, pop ups and script
Good Morning!
I need help! I am trying to write a code for dreamweaver, so
that anybody who clicks on an external link gets a pop up message
with the option to continue or cancel. I have a behavior on click
for each individual external link, however, I would love to do a
code and put it on the template so that everytime I add an external
link to the site, I dont have to worry about remembering to add the
behavior!
Please help, :) I am still a new web designer and I am
learning.
Thank you very much!
AmandaYou may find this script useful. It opens all off-site links
in a new
window (auto) or you can set it so that visitors decide
whether or not to
open links in a new window (manual).
http://www.dynamicdrive.com/dynamicindex8/newwindow2.htm
--Nancy O.
Alt-Web Design & Publishing
www.alt-web.com
"Amanda7702" <[email protected]> wrote in
message
news:fflbt3$ed4$[email protected]..
> Good Morning!
> I need help! I am trying to write a code for
dreamweaver, so that anybody
who
> clicks on an external link gets a pop up message with
the option to
continue or
> cancel. I have a behavior on click for each individual
external link,
however,
> I would love to do a code and put it on the template so
that everytime I
add an
> external link to the site, I dont have to worry about
remembering to add
the
> behavior!
> Please help, :) I am still a new web designer and I am
learning.
> Thank you very much!
> Amanda
> -
Script to break external links in Excel?
Is there a script I can use to break all external links in Excel (2004)?
Thanks!Hi,
krt1 wrote:
I updated the script but the links still aren't clearing.
If I run this script :
tell application "Microsoft Excel"
tell active workbook
repeat with tName in (get link sources type link type Excel links)
break link name tName type link type Excel links
end repeat
repeat with tName in (get link sources type link type OLE links)
break link name tName type link type OLE links
end repeat
end tell
end tell
The menu item "Links ..." in menu "Edit" is disabled.
Is this the same thing with your workbook ?
If yes and you still have links:
If you copy the formula of a link and paste it into the formula of a cell, it will not be considered as a link object.
Excel Link is an inserted object, or by copy/paste a link object, you can change the range in the formula, the range is changed but the object is always a link. -
Exchange Converts embedded link to http when Sending to External Recipients
Hello:
We use a product called ProjectWise internally. One of the features is to embed the link to a ProjectWise document in the body of an e-mail and send it to other users. When ProjectWise embeds the link, it is in the format:
pw://path_to_file
Obviously, this is very similar to the http format. The pw:// link allows the file to be opened natively in the ProjectWise software.
Here's the issue:
When sending to other INTERNAL users, the link flows through correctly. However, when it is sent to an EXTERNAL user, the link is converted from pw:// to http:// and is useless.
We can even send the same email to both Internal and External users, the Internal users receive correctly, the External users receive the converted link.
I am thinking that Exchange is somehow modifying the link when sending to external, but I can't find anything on it.
Thanks,
TimHi Tim,
Base on my knowledge, by default, exchange system does not modify the content of the email, except you create some transport rule.
Do external user use exchange ? or any other email system?
In addition, the format of "pw://" is only useful for internal, when you open the "pw://" link from internet, Browse may automatically converted the link to "http://".
Best regards,
Niko Cheng
TechNet Community Support -
How to Load an external swf using loadmovie in AS3
I need to create a button with script, on rollover load an external swf into movieclip in AS3. This was able to create this in AS2, but I need to create this in AS3
Thanks again Ned.
Kenneth Russell
graphic artist, Sr.
Lockheed Martin - MS2
2323 Eastern Blvd., Baltimore, MD 21220
Phone 410.682.0554 Fax 410.682.0543
From: Ned Murphy <[email protected]>
Reply-To: [email protected]
Date: Thu, 23 Jul 2009 19:08:25 -0600
To: kenneth russell <[email protected]>
Subject: How to Load an external swf using loadmovie in AS3
In AS3 you use the Loader class to load external swf's and image files. You
should be able to find examples both in the Flash help files and these forums
if you search. If you aren't aware of how to code buttons in AS3, that can be
found as well. In AS3, just about any kind of interction involves the use of
event listeners in combination event handler functions... in the case of a
button rollover an example would be...
btnName.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
// your loading code or whatever
> -
How would you convert ToC links to cross references?
Hello gang,
InDesign CS6 can export to ePub, and can support the exporting of one ToC to ePub hyperlinks, but cannot support two. Is there a script or plug-in that you know of that can take a second or third selected ToC generated, and convert its links to cross-references, so that more than one ToC can result in an html-based link once we export to ePub?
Many thanks for any pointers,
Mike Witherell in MarylandHi Ariel,
Can you let me know if your script could be useful to me? Here's my situation:
I have a ~250 page document with a lot of named cross references.
I want to generate a formatted list at the end of the document of all these cross references, in the order they appear in the text, in a format like this:
P<page no>, <name of reference>: Note about this cross reference.
(where the <page no> and <name of reference> are drawn from the text anchor in the main text of the document, and the note about the reference is manually typed in to the reference list.)
Any thoughts appreciated! I have a decent handle on Javascript in a web development context but haven't used it to script InDesign before.
Thanks
Pat -
HI,
I am a converted Frontpage user.
I use to use a utility in Frontpage that would check my site
for broken external links. I have found the check broken links but
it says "The only links that Dreamweaver verifies are links to
documents within the site; Dreamweaver compiles a list of external
links that appear in the selected document or documents, but does
not verify them."
How can I check for broken external links.
Thanks for the help
BTW I am useing Dreamweaver 8
MarkThank you will give it a try...
-
Opening an external link using javascript. Keeping new window in front
I am displaying a photo from an external link when called upon from my swf. When the user clicks a button, up pops a corresponding photo in a new browser window. After the photo window has opened, if the user clicks another button the photo browser will update but its no longer in front. I know I need to use the focus() command but cannot figure how to incorporate it into my AS3 code.
var req=new URLRequest();
function scrollPanePopulate(event:Event){
//create the temp variables
var calledPhoto=pntxml.row[pointindex].PhotoUrl;
req=pntxml.row[pointindex].PhotoUrl;
var jscommand:String = "var newwin=window.open('"+req+"','win','height=400,width=600,left=650,top=50,toolbar=no,scrollbars=yes,location=no');";
var url:URLRequest = new URLRequest("javascript:" + jscommand +"void(0);"); navigateToURL(url, "_self");
The above code works great but I want to keep the photo window in front when it is refreshed. Any suggestions?
thanks in advance...
-joshvar req=new URLRequest();
function scrollPanePopulate(event:Event){
//create the temp variables
var calledPhoto=pntxml.row[pointindex].PhotoUrl;
req=pntxml.row[pointindex].PhotoUrl;
var jscommand:String = "var newwin=window.open('"+req+"','win','height=400,width=600,left=650,top=50,toolbar=no,scrollbars=yes,location=no');";
var url:URLRequest = new URLRequest("javascript:" + jscommand +"void(0);newwin.focus();");
navigateToURL(url, "_self"); }
// p.s. you should be using externalinterface class. -
Preserve mailbox permissions after converting to linked mailboxes
Hello,
I am converting normal user mailboxes to linked mailboxes in Exchange 2007 SP3. After a pilot, we found that the linked accounts no longer had access to shared mailboxes (the share mailboxes will NOT be converted into linked accounts). The Full Access
ACL references the OLDOMIAN\username AD account. Manually adding NEWDOMAIN\username to the ACL fixes things. Is there an easy way to export the Full Access and Send As permissions for the shared mailboxes and switch them to NEWDOMAIN\username with
PowerShell? I have a feeling this will involve a lot data manipulation with Excel. Too bad there is no ADMT style security translation tool for Exchange mailboxes!It's definetly possible to do this entire task via powershell script but need to spend some time to write it... ;)
But well, here is another quick way I can suggest it's two step process...
1. Export Full Access and Send-As to csv files seperately by following this Exchange Powershell Tip #09
2. Now you have two files, replace the domain name in exported csv files.
3. Import the permission back using this...
$FullAccess = import-csv mailboxaccess.csv
$FullAccess | %{Add-MailboxPermission -Identity $_.Identity -User $_.user -AccessRights $_."Access Rights"}
$SendAs = import-csv sendas.csv
$SendAs | %{Add-ADPermission -Identity $_.identity -User $_.user -AccessRights Extended -ExtendedRights $_."Access Rights"}
Blog |
Get Your Exchange Powershell Tip of the Day from here
Maybe you are looking for
-
How to include a photo on an email in yahoo
Hi, How do I pull a photo from iphotos and attach it to an email that I have written in yahoo ?
-
Minisap 4.6 login Problem
Hi All, I have installed minisap 4.6c in my pc... my os is Win XP service pack 2.... i faced the following problem when i tried to logon.. description : MBS SID :MBS application server : my pc name or IP address sap system : R/3 system number : 00 I
-
N70 battery suddenly drains in one day
I got my N70 on March 23 2006 (9 months ago). I haven't had the slightest problem with it until now! All of a sudden it started to drain the battery in just a few hours after being fully charged. my F/W version is 3.0546.2.3 18-11-05 RM-84 I bought a
-
I can't find application support!
Help! I am trying to do some work for a game, and I need application support. It's not under Library. I have OS X Lion, so does that make a diffrence. Is it possible to accidently delete it? Can i reinstall it or get it again?
-
Iphone 5 battery life after updating to ios 7.1
Has anyone else suffered rapid battery drain after updating to ios 7.1?