A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: navigating in flash using javascript

  1. #1
    Senior Member
    Join Date
    Mar 2004
    Location
    Upper Marlboro, MD
    Posts
    146

    navigating in flash using javascript

    I have a flash movie that has 3 links. Each link navigates to different sections of a html page via the getUrl event onrelease: url(index.html#section1) etc.

    I also have a navigation bar setup inside the html page (which I want to remove)... The code in the HTML is basic: see below:
    Code:
    <ul class="nav">
                    <li><a href="#section1">1</a></li>
                    <li>2</li>
                    <li><a href="#section3">3</a></li>
                </ul>
    The javascript below calls some jquery files when the links are clicked and scrolls to the associated section. I want to use that javascript in my flash movie and navigate from the movie. I don't know how to change the function below to make it work with the flash links that I have. can anyone assist me with this? Here is the Javascript I have in my HTML page. (and it works fine by the way.

    Code:
    <!-- The JavaScript -->
    	<script type="text/javascript" src="jquery.min.js"></script>		
            <script type="text/javascript" src="jquery.easing.1.3.js"></script>
            <script type="text/javascript">
            
                
                $(function() {
                    $('ul.nav a').bind('click',function(event){
                        var $anchor = $(this);
                        /*
                        if you want to use one of the easing effects:
                        $('html, body').stop().animate({
                            scrollLeft: $($anchor.attr('href')).offset().left
                        }, 1500,'easeInOutExpo');
                         */
                        $('html, body').stop().animate({
                            scrollLeft: $($anchor.attr('href')).offset().left
                        }, 1000);
                        event.preventDefault();
                    });
                });
    
    	
            </script>

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    21
    Sorry for the late reply, but I saw this and figured I would post it here for you in case you haven't yet found a solution.

    What you want to do sounds like using JavaScript to communicate with ActionScript. If you're using AS3, there is a nice article which explains a little bit about this so that you can access certain parts of the Flash via the URL and anchor tags.

    The article is: http://www.emanueleferonato.com/2010...lash-with-as3/

    I'm sure you can do the same so that clicking on a link changes the SWF, you just might need to do a bit of digging around in the code file. Hopefully this a good start for you though if you still need assistance.

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