A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [CS3] linking pages

  1. #1
    Member
    Join Date
    May 2008
    Posts
    33

    [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

  2. #2
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    on the button put:
    PHP Code:
    on (release){
        
    getURL("yourhtmlfile.html""_self");


  3. #3
    Member
    Join Date
    May 2008
    Posts
    33
    i just tried that code and it didn't work. it said there were some errors

  4. #4
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    Are you using Flash or Dreamweaver to create these buttons?

  5. #5
    Member
    Join Date
    May 2008
    Posts
    33
    im using flash cs3

  6. #6
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    Are you running Actionscript 2 or 3?

    that code should work with actionscript 2.

  7. #7
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    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.CLICKonClick);

    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. |


  8. #8
    Has Returned
    Join Date
    Mar 2001
    Posts
    269
    Quote 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.

  9. #9
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    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. |


  10. #10
    Member
    Join Date
    May 2008
    Posts
    33
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center