Loading ...
Sorry, an error occurred while loading the content.

Re: [FlashLite] fscommand2("GetPlatform")

Expand Messages
  • Brent Arnold
    What about indexOf. var platform:String = fscommand2(³GetPlatform², ³platform²); If(platform.toLowerCase().indexOf(³nokia²) != -1) { // you¹ve got nokia
    Message 1 of 13 , Mar 4, 2009
    View Source
    • 0 Attachment
      Re: [FlashLite] fscommand2("GetPlatform") What about indexOf.

       var platform:String = fscommand2(“GetPlatform”, “platform”);
      If(platform.toLowerCase().indexOf(“nokia”) != -1)
      {
         // you’ve got nokia
      }


      iBrent


      From: Scott Janousek <scott@...>
      Organization: scottjanousek.com
      Reply-To: <FlashLite@yahoogroups.com>
      Date: Wed, 04 Mar 2009 11:10:23 -0500
      To: <FlashLite@yahoogroups.com>
      Subject: Re: [FlashLite] fscommand2("GetPlatform")

       
       

      Nope no built in trim as in PHP, in AS2 ... but if you search there are
      tons of custom functions out there for reuse.

      -sj

      On 3/4/2009 5:02 AM, Barry Beattie wrote:
      > Dale, is there a "trim()" function availble to help here?
      >
      >
      > if (trim(fscommand2(“GetPlatform”, “platform”)) == " “Nokia OS" )
      > {
      >   // etc....
      > }
      >
      >
      >    

        
          


    • Weyert de Boer
      The issue I have had was bugs in the API calls for FL. I have had a custom device which runned FL. I had to use fscommand2 access specific native
      Message 2 of 13 , Mar 4, 2009
      View Source
      • 0 Attachment
        The issue I have had was bugs in the API calls for FL. I have had a
        custom device which runned FL. I had to use fscommand2 access specific
        native functionality. Only the issue was that when you wanted to write
        data to a text file and read it again. And some calls similar to
        GetPlatform would include garbage data. Like stuff after the null
        character of the string which makes it hard to compare or use it.
        Because it was hard to remove the garbage (random length). Really
        enjoying...
      • Brent Arnold
        Sorry if this post gets double posted, I thought my email response would go through... What about using indexOf()? var platform:String =
        Message 3 of 13 , Mar 4, 2009
        View Source
        • 0 Attachment
          Sorry if this post gets double posted, I thought my email response would go through...

          What about using indexOf()?

          var platform:String = fscommand2("GetPlatform", "platform");
          if (platform.toLowerCase().indexOf("nokia") != -1)
          {
          // you've got a Nokia phone
          }


          iBrent



          --- In FlashLite@yahoogroups.com, Scott Janousek <scott@...> wrote:
          >
          > that's my favorite, but it depends on your needs. :)
          >
          > On 3/4/2009 11:15 AM, Jesse Warden wrote:
          > >
          > > like:
          > >
          > >
          > > var str = "cow ";
          > > str = str.split(" ").join("");
          > >
          > > On Wed, Mar 4, 2009 at 11:10 AM, Scott Janousek
          > > <scott@... <mailto:scott@...>> wrote:
          > >
          > > Nope no built in trim as in PHP, in AS2 ... but if you search
          > > there are
          > > tons of custom functions out there for reuse.
          > >
          > > -sj
          > >
          > > On 3/4/2009 5:02 AM, Barry Beattie wrote:
          > > > Dale, is there a "trim()" function availble to help here?
          > > >
          > > >
          > > > if (trim(fscommand2("GetPlatform", "platform")) == " "Nokia OS" )
          > > > {
          > > > // etc....
          > > > }
          > > >
          > > >
          > > >
          > >
          > >
          > >
          >
        • Scott Janousek
          Detecting device platform info ... here is a good starting point for Nokia specific device platforms (but can be adapted to other platforms supporting
          Message 4 of 13 , Mar 4, 2009
          View Source
          • 0 Attachment
            Detecting device platform info ... here is a good starting point for Nokia specific device platforms (but can be adapted to other platforms supporting fscommand2 as well):

            http://library.forum.nokia.com/index.jsp?topic=/Flash_Lite_Developers_Library/GUID-0772B436-6988-45FE-8C96-BEEAE461D48B.html

            -sj

            On 3/4/2009 1:19 PM, Brent Arnold wrote:

            Sorry if this post gets double posted, I thought my email response would go through...

            What about using indexOf()?

            var platform:String = fscommand2(" GetPlatform" , "platform");
            if (platform.toLowerCa se().indexOf( "nokia") != -1)
            {
            // you've got a Nokia phone
            }


          • Barry Beattie
            ... hang on, that won t work: Nokia OS would be NokiaOS you re splitting the string into an array based on a space as the delimiter and then joining the
            Message 5 of 13 , Mar 4, 2009
            View Source
            • 0 Attachment
              > var str = "cow ";
              > str = str.split(" ").join("");

              hang on, that won't work:

              "Nokia OS " would be

              "NokiaOS"

              you're splitting the string into an array based on a space as the delimiter

              and then joining the array to a string. Any delimiter occurance would
              be a new array element to then join (now without the space)
            • Darren Osadchuk
              Probably other ways to do it, but: var str = Nokia OS ; while (str.charAt(str.length-1) == ) { str = str.substr(0, str.length-1); } would work. D.
              Message 6 of 13 , Mar 4, 2009
              View Source
              • 0 Attachment
                Probably other ways to do it, but:

                var str = "Nokia OS ";
                while (str.charAt(str.length-1) == " ") {
                str = str.substr(0, str.length-1);
                }

                would work.

                D.

                Barry Beattie wrote:
                >
                >
                > > var str = "cow ";
                > > str = str.split(" ").join("");
                >
                > hang on, that won't work:
                >
                > "Nokia OS " would be
                >
                > "NokiaOS"
                >
                > you're splitting the string into an array based on a space as the delimiter
                >
                > and then joining the array to a string. Any delimiter occurance would
                > be a new array element to then join (now without the space)
                >
                >
              • Weyert de Boer
                Depends if the null character is getting translated to a space also in these methods. If not, it would work if you use String.fromCharCode(0) probably.
                Message 7 of 13 , Mar 4, 2009
                View Source
                • 0 Attachment
                  Depends if the null character is getting translated to a space also in
                  these methods. If not, it would work if you use String.fromCharCode(0)
                  probably.

                  > Probably other ways to do it, but:
                  >
                  > var str = "Nokia OS ";
                  > while (str.charAt(str.length-1) == " ") {
                  > str = str.substr(0, str.length-1);
                  > }
                  >
                  > would work.
                  >
                  > D.
                  >
                  > Barry Beattie wrote:
                  > >
                  > >
                  > > > var str = "cow ";
                  > > > str = str.split(" ").join("");
                  > >
                  > > hang on, that won't work:
                  > >
                  > > "Nokia OS " would be
                  > >
                  > > "NokiaOS"
                  > >
                  > > you're splitting the string into an array based on a space as the
                  > delimiter
                  > >
                  > > and then joining the array to a string. Any delimiter occurance would
                  > > be a new array element to then join (now without the space)
                  > >
                  > >
                  >
                  >
                • Maxim Antinori
                  Agree with iBrent, I like the indexOf approach to this, simpler/faster than splits and joins...
                  Message 8 of 13 , Mar 5, 2009
                  View Source
                  • 0 Attachment
                    Agree with iBrent, I like the indexOf approach to this, simpler/faster than splits and joins...

                    >
                    > var platform:String = fscommand2("GetPlatform", "platform");
                    > if (platform.toLowerCase().indexOf("nokia") != -1)
                    > {
                    > // you've got a Nokia phone
                    > }
                    >
                    >
                    > iBrent
                    >
                    >
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.