-
[CS3] linking pages
hi, i had this problem for a while with adding some sort of link to a button i created on flash so when i click it, it will go to an html file on my computer.
i want it to work so when i add .swf button to dreamweaver and i test it out there it will go to the certain html file without opening a new window
i know that i have to put in an <a href code in the actionscript to do so but it doesn't work. could someone help me create a text that i can put in the action script so the button will work
-
on the button put:
PHP Code:
on (release){ getURL("yourhtmlfile.html", "_self"); }
-
i just tried that code and it didn't work. it said there were some errors
-
Are you using Flash or Dreamweaver to create these buttons?
-
-
Are you running Actionscript 2 or 3?
that code should work with actionscript 2.
-
trace("AKA: Biro Barna");
Be sure that the code Turbs posted is placed directly on your object ( movie clip or button ) otherwise you'll get errors. It's not really a good practice putting code on object so you could use this instead ( this code goes on frame ):
PHP Code:
movieClipInstanceName.onRelease = function():Void { getURL("yourhtmlfile.html", "_self"); }
Or if your are using AS 3.0 then you should use this ( code goes only on frames ):
PHP Code:
movieClipInstanceName.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void { navigateToURL(new URLRequest("yourPage.html"), "_self"); }
Good luck.
| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
Originally Posted by PlenaryCreation
It's not really a good practice putting code on object so you could use this instead ( this code goes on frame ):
So we meet again...
So, you following me now? What ya mean it's not good practice, back in flash 5 days that's all we had to work with? Not good practice?!?!
Okay ya right, im only kidding.
-
trace("AKA: Biro Barna");
Well, the Flash 5 days are kinda over We're living in the Flash 9 age... It's a bad practice because your code is not organized and making future changes could be a pain in the ass if you need to go 20 levels down to find 1 out of 100 other movie clips that has an on(release) on it... placing all the code on the frames is a much better practice because that way, you'll have all the code in one place and you can easily find it no matter what... The evidence for this is AS 3.0 where ALL THE CODE goes ONLY ON FRAMES, you aren't allowed to place any code on objects in AS 3.0. An even better practice would be to use classes and packages to organize code but that's another thread...
Don't worry, I'm not following you, I'm just clicking on random threads...
| Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro | WebLog: http://blog.wisebisoft.com/ |
| Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
| Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/ | By perseverance the snail reached the ark. |
-
thankyou! the code actually worked!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|