×

Discussion Board

Results 1 to 4 of 4

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    12

    How to do (back & forward) like website in flash lite?

    Hi all,
    It's my first topic and i need some help in my app
    My app containts pages(like website) and i want to browsing them
    by right and left keys..back and forward how can i do that?
    And i will put this information inside a dynamic text and creating a veriable holding information..is there a better way than this?
    Thanks in advance

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    6

    Re: How to do (back & forward) like website in flash lite?

    Hi issanasr13,

    The way I would do it is to set up an array of names for your pages, then increase and decrease a page number variable with a Left and Right key press, which will reference the pages in the array.

    Code:
    // Set up pages array
    var pages_array:Array = new Array();
    pages_array[0] = "home";
    pages_array[1] = "about";
    pages_array[2] = "links";
    
    // initialise page number and name
    var pageNum:Number = 0;
    var pageName:String = pages_array[pageNum];
    
    // set up key listener and Key class
    var keyListener:Object = new Object();
    keyListener.onKeyDown = onKeyDownHandler;
    Key.addListener(keyListener);
    
    // function to handle the key press
    function onKeyDownHandler():Void {
      // store the key that has been pressed
      var keyCode:Number = Key.getCode();
      if (keyCode == Key.LEFT){
        // decrease the pageNum variable
        if (pageNum > 0){
          pageNum--;
          setPage();
        }
      } else if (keyCode == Key.RIGHT){
        // increase the pageNum variable
        if (pageNum < 2){
          pageNum++;
          setPage();
        }
      }
    }
    
    // function to handle the new page
    function setPage():Void {
      pageName = pages_array[pageNum];
      trace("pageNum = " + pageNum);
      trace("pageName = " + pageName);
      // put some code here to load the new page
      // or goto a frame on the timeline, etc
      // based on the value of pageName
    }
    Hope this helps.
    Paul

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    12

    Re: How to do (back & forward) like website in flash lite?

    Thanks very much PaulLamonby for your help ..but i have one query about the last code
    // function to handle the new page
    function setPage():Void {
    pageName = pages_array[pageNum];
    trace("pageNum = " + pageNum);
    trace("pageName = " + pageName);
    this._parent._parent.attachMovie("page1")
    this._parent._parent.attachMovie("page2")
    }
    It didn't work like this..what i should write instead of the last 2 lines
    And by the way my pages are Movieclips(page1,page2 and page3..etc)
    Thanks again

  4. #4
    Registered User
    Join Date
    Jul 2008
    Posts
    6

    Re: How to do (back & forward) like website in flash lite?

    Hi issanasr13,

    What timeline have you written the code on? This will determine what path you need to use to load the 'pages'. I suggest placing all your code on the _root timeline in frame 1.

    You also need to use the correct parameters when using attachMovie(idName, instanceName, depth)

    e.g. If your code is on the _root timeline, the code below will attach a movieClip from the library, with a linkage ID name of 'home' to the _root timeline. It will have an instance name of 'home_mc' and a depth relevant to the next highest available depth.

    Code:
    // Set up pages array
    var pages_array:Array = new Array();
    pages_array[0] = "home";
    pages_array[1] = "about";
    pages_array[2] = "links";
    
    // initialise page number and name
    var pageNum:Number = 0;
    var pageName:String;
    
    // function to handle the new page
    function setPage():Void {
    pageName = pages_array[pageNum];
    var instanceName:String = pageName + "_mc";
    this.attachMovie(pageName, instanceName, this.getNextHighestDepth());
    }
    
    // call the setPage function
    setPage();
    Regards
    Paul

Similar Threads

  1. Welcome to Flash Lite Discussion
    By Nokia Ron in forum Qt
    Replies: 21
    Last Post: 2011-06-07, 12:22
  2. Getting Flash Lite installed on Flash Lite enabled but not pre-built devices!
    By sirbijan in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2008-06-04, 07:39
  3. Nokia N95 8GB adds Flash Lite 3 support
    By biskero in forum [Archived] Flash Lite on Nokia Devices
    Replies: 17
    Last Post: 2008-02-15, 21:59
  4. Flash Lite handsets poll
    By ilyadanilov in forum Series 40 & S60 Platform Feedback Archive
    Replies: 11
    Last Post: 2006-07-04, 23:17
  5. S60 2nd FP3 and 3rd - Flash Lite frustration
    By ilyadanilov in forum General Development Questions
    Replies: 7
    Last Post: 2006-02-08, 19:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •