A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: Coder & Decoder

  1. #1
    Junior Member
    Join Date
    Aug 2000
    Posts
    26
    OK I'm setting up a Flash application that takes the inputed text and codes it. I have it all set up where you type the text into an input box, and push go. But, how would I get the code to actually encode with flash? Would I use variables or...

    ~Chuck

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    You're certainly going to need variables.

    What type of coding are you planning?

    Can't really suggest a way until you give further details,

    Rich.


  3. #3
    Junior Member
    Join Date
    Aug 2000
    Posts
    26
    Well I am just going to set up a program that takes a message i.e.

    Send Help Now

    and code it in a basic
    a=d
    b=e
    c=f
    and so on. So our example message will equal

    Vhqg Khos Qry

    Any help would be greatly appreciated!

    ~Chuck

    P.S. I could send the fla if interested

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    you need to extract substring from variable.

    and then use a lot of "if" to code the message.

    if you need code post the message.

  5. #5
    Junior Member
    Join Date
    Aug 2000
    Posts
    26

    Wink

    Well you might as well be talking to me in ancient greek because I am an absolute idiot when it comes to flash :-) If you would do me the HUGE favor as to post maybe 3 of the 'if' codes and whatever it was that you said before then, it would be a ton of help. Thank you soooooooo much.

    ~Chuck

  6. #6
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    one minute please

  7. #7
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    Put the following on a button.

    On (Release)
    Set Variable: "coded" = ""
    Set Variable: "loop" = 1
    Loop While (loop<=length(orig))
    Set Variable: "testchar" = Substring(origtext,loop,1)
    Set Variable: "testchar" = chr(ord(testchar)+3)
    If (testchar gt "z")
    Set Variable: "testchar" = chr(ord(testchar)-26)
    End If
    Set Variable: "coded" = coded&testchar
    Set Variable: "loop" = loop+1
    End Loop
    End On


    In the above variable "origtext" is the text you need converting.
    The encoded text will be in variable "coded"

    The above will convert xyz to abc. I've tried kept it simple so you can see the technique and amend as required so spaces are converted to # (no test to see if it's a space).

    Let me know if you need more,

    Rich.

  8. #8
    Senior Member
    Join Date
    Jul 2000
    Posts
    198
    nise script rich

    I made one by myself, i don't think it's better but i think it's more simle.


    On (Release)
    Loop While (x <> MBLength ( input ))
    Set Variable: "x" = x + 1
    Set Variable: "character" = Substring ( input, x, 1 )
    If (character eq a)
    Set Variable: "chracter" = "z"
    Else If (character eq b)
    Set Variable: "chracter" = "g"
    Else If (character eq c)
    Set Variable: "chracter" = "k"
    Comment: and so on
    End If
    Set Variable: "outputing" = "outputing & character"
    End Loop
    Set Variable: "output" = "outputing"
    End On

    [Edited by Casparas on 08-10-2000 at 04:51 PM]

  9. #9
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    There is a lot of typing doing it your way having an if statement for each character to convert.

    And just in case cph2686 is going to use your way the last two variables assignments should be expressions

    Rich.


  10. #10
    Junior Member
    Join Date
    Aug 2000
    Posts
    26

    Cool

    and if you gentlemen would be so kind as to answer one more question, after it is converted (I will use Rich's script btw), how would I get it to display in a text box in the new frame? Thank both of you soooooo much.

    ~Chuck

    P.S. If you need a can send the fls
    P.P.S. Call me Chuck, not cph2686

  11. #11
    Senior Member
    Join Date
    Mar 2000
    Posts
    597
    Chuck,

    email me and I'll send it to you.

    Rich.

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