dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Encoding information in a flash app

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    2

    Encoding information in a flash app

    Hello. I recently have been working on a Math tutorial in flash. This tutorial has examples and other things in it. I already have completed the trigonometry and geometrical formula segment. I am now working on the advanced algebra segment, and am working specifically with matrices. WHat I wish to do in this matrix example, is to demonstrate to students real life applications. I wish to have a random mesage entered, of only western letters and all normal characters but no numbers at this point. (I would love to write this for foriegn letters, and languages such as ancient greek but have no idea how to even get flash to recognize these languages). A sample message could be, "flash is fun". What I want to do is set up a system for converting characters to numbers(since f is the 6th letter of the alphabet, we'll say f=6 and so on, spaces wil be 0) so flash is cool=6,12,1,19,8,0,9,19,0,3,15,15,12. Then I want to convert these numbers into 2x1 matrices, so matrix 1 would be {6,12}
    matrix 2 would be {1,19} etc. Then I want to multiply each matrix
    by

    a random 2x2 matrix which has an inverse, or for simplicity we'll say just matrix {2,1}
    {1,1}. We then get a totally new code, so matrix 1 now would be 24,18 i believe. THis would end the encoding part of the flash app. Next I want to decode it, so I'd multiply the new code or encoded message by the inverse of the matrix I multiplied matrix 1 by(the inverse would be {1,-1} ).
    {-1,2}
    This would get me the original matrix 1.

    I want the app to translate this matrix to its letter equivalent so matrix one,or 6,12, would be "fl". In this way, students can see how each step is completed and how they might have gone wrong. I realize this would be a hard and complicated script and will gladly give credit for this app to anyone who helps. I believe flash would support this kind of programming, but if not I know java will, so if any of you are fluent in java I could use your help too. When I post thjis, the matricesmight get out of order, so if u need the numbers email me, but in general how would u do this.
    Last edited by claypigeon; 12-14-2002 at 01:18 AM.

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    this is an interesting idea.
    (I'm a math student myself)

    I'll be away for a week, so I won't be of much help, altough I'll think of this.

    I have some doubts:
    What about "a" and "A"? uppercase/lowercase letters...
    What if you have a sentence with an odd number of characters? (this won't be very difficult... creating a new number for a non existing character)

    And why don't you use the predefined method?
    myString.charCodeAt(index)

  3. #3
    Young Senior Member mayhem_sci's Avatar
    Join Date
    Jun 2002
    Location
    Singapore
    Posts
    282
    interesting to me too, a maths teacher

    i'd define a couple of objects first. First on the list would be a 2D vector, since you group your codes in 2d vectors. that's easy. next is the 2x2 matrix. i've thought about this and believe the simplest way is to define that as an object composing of 2 2d vectors. or we can just define it using 4 components. ok. it'd require more thoughts to decide whether we want to define a matrix transformation of a vector as a method of the vector object or the matrix object (my first intuition is to define it as a method of the vector object). the matrix object would also require a method to test whether its inverse exist, and a method which will return an inverse matrix if it is inversible.

    then an object defining a message. the constructor will require an Array (of the original message) which the message object will allocate to an Array of 2d vectors, plus a 2x2 matrix (default to the 2x2 identity matrix). it will then have a code method which will generate a random matrix object, test it's inversibility, and return a new message object with the encoded message plus the inverse matrix of the encoding matrix. the purpose of including a matrix with the message object is to allow easy decoding. the last method will be a decoding method which will the the matrix defined in a message object and use this to decode the message.

    to extend this, we can add a method for the matrix object for matrix multiplication, so that we can do multiple coding.

    how's that? too sketchy i suppose.
    Last edited by mayhem_sci; 12-14-2002 at 04:22 AM.

  4. #4
    Junior Member
    Join Date
    Dec 2002
    Posts
    2
    Thanks for the responses. More would be appreciated. In the case of matrices and their inverses, we could check to see if the matrix has an inverse by using Cramers rule (ad-cb does not equal zero if the matrix has an inverse). Responding to the problem presented by Nuomira,since this is just a simple tutorial and not a complex applicatuion, we do not have to worry about capitol and lowercase letters, although we could just assign a new number to them, and in the case of odd numbered messages, we could add a period or some form of punctuation, which would then have a number assigned to it

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