A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Here's an approach to making a CD

Hybrid View

  1. #1
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128

    Here's an approach to making a CD

    My problem w/ using Flash for CD's has been loading media and saving variables. Presently, I use a Director shell to deal w/ both problems, but I'm trying to use Flash MX to get away from that. I think its overkill for most of my work and I really like the results I get w/ Flash.

    I think I've gathered enough help from various Flashkit (thank you)and Macromedia sources to create a good approach. I'd like to share it and get some feedback.

    Solution 1: Saving Varibles
    The shared objects that someone described as "like cookies for flash" can be used to save and recall varibles.

    Recalling the Variable
    so = SharedObject.getLocal("myInfo");
    MyColor = so.data.favoriteColor;

    Saving the Variable

    so = SharedObject.getLocal("myInfo");
    mycolor = "orange";
    so.data.favoriteColor = mycolor;
    // Displays: orange

    Mac compatibility is another problem I've experienced. However, becasue this is a standard Flash MX function, I undersdand that it works for MAC's ... but I haven't tested it on a MAC.

    Solution 2: Loading Media
    You can use the .load commands to dynamically load pictures, video ( i think ) and sounds. I deal w/ a lot of event sounds and this works quite well.


    sndObj = new Sound();
    sndObj.loadSound("xjump.mp3");
    sndObj.start();

    So, if you just need to save user profiles and would like flash to serve as a container for sound and other media, this should work. I'm going to build a prototype now, but, first, I'm curious if anyone anticipate problems w/ these methods?

    Thanks.

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Posts
    218
    Your fogetting to Flush your shared object. You have to add so.Flush to save them to a machine.
    http://www.macromedia.com/support/fl..._object04.html
    lesley paone
    www.aritali.com

  3. #3
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    Hmmm, I'm going to add it but that bothers me becasue its working without the flush. I'm wondering if the flush is only neccesary when the swf is running off the web? In that case, I'll need it depending on how I package this application.

    On a related note, I didn't need this line to save:

    so = SharedObject.getLocal("myInfo");

    just this:

    mycolor = "orange";
    so.data.favoriteColor = mycolor;

    and I'm guessing the so.flush will come next.

    Thank you.

  4. #4
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    Ok, I get it now ... nothing to do with the web:

    ".flush immediately writes a locally persistent shared object to a local file. If you don't use this method, Macromedia Flash MX writes the shared object to a file when the shared object session ends—that is, when the SWF movie is closed or when the shared object is garbage-collected because it no longer has any references to it."

    Thanks for the link

  5. #5
    Originally posted by pitchdog
    Ok, I get it now ... nothing to do with the web:

    ".flush immediately writes a locally persistent shared object to a local file. If you don't use this method, Macromedia Flash MX writes the shared object to a file when the shared object session ends—that is, when the SWF movie is closed or when the shared object is garbage-collected because it no longer has any references to it."

    Thanks for the link
    This is interesting, and I wonder if it can be used to do what I am trying to accomplish: I have a Flash movie on a home page that uses a shared object to detect whether the visitor has been to the site before, and if so, skips the intro part of the movie and goes straight to the static part. So, a visitor only sees the intro once, EVER. Now the client wants to change it so the visitor only sees the intro once PER VISIT.

    This is not the same as once PER DAY -- I mean the visitor could visit in the morning and see the intro once during that visit, then logoff the site and the visit would be over. But if they came back that night, they would see the intro again because it was a new "visit."

    I can easily modify it up to play the intro once PER DAY, but I'm thinking the only way to play it once per visit is with cookies (which I'm not familiar with). Is this correct, or am I being pessimistic?

  6. #6
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    That's an interesting problem, and I think it would be a proper application for these "cookies" as I'm skeptical about their long-term use. I guess you'd just have to toggle a varible between "seen" and "notseen" as they left the site.

    I have an example, here, that shows the "cookies" working. It "remebers" the hexagons that you selected. You can click a pattern and return a month later and its still there. I though of making it into a flash lite-brite but that won't pay the bills.

    http://home.twcny.rr.com/jpitcher/hex.swf

  7. #7
    Flash Guru wanna-be cylon's Avatar
    Join Date
    May 2002
    Location
    Galactica
    Posts
    205
    Originally posted by pitchdog
    That's an interesting problem, and I think it would be a proper application for these "cookies" as I'm skeptical about their long-term use. I guess you'd just have to toggle a varible between "seen" and "notseen" as they left the site.

    I have an example, here, that shows the "cookies" working. It "remebers" the hexagons that you selected. You can click a pattern and return a month later and its still there. I though of making it into a flash lite-brite but that won't pay the bills.

    http://home.twcny.rr.com/jpitcher/hex.swf
    Cool example, but how do you create multiple shared objects???
    also, how would this work if you were running it from a CD?

    Could you post or send me a copy of the hexagon fla...?
    Much appreciated.thnx for sharing!

    Cheers.........Cylon
    Step away from your monitor<br>go surfing!

  8. #8
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128

    Hexagons

    Here's the HEX. I used ACT and PASS in there a lot - to me it means "Activity" and "Pass."

    It does work on a CD. And I hear it works on a MAC as well. I have reservations on making a CD this way becasue I'm not sure if someone could purge the data by accident. In short, I'm not confident enough in the proccess to make a multiuser CD ... I may put a beta test out using this method. I wouldn't have any reservations using it for a demo cd - to indicate areas where the user has already visited, for instance.

    I'm not 100% sure what you mean by multiple shared objects becasue I'm thinking too much. If you mean more than one shared varible, its just a matter of defining one. And you can set the path for the stored data. I'm saving to a folder called hexdata and I used the shared object var SO. Check it out and see if that makes sense.

    If your interested in colored hexes, I did get around to making the multi-colored hex game. It reminds me of something out of "Land of the Lost" (sorry for that obscure reference) Anyway, the code for the color obscures the point of this string so I think this, though less sophisticated, is better to tear apart.
    Attached Files Attached Files

  9. #9
    Flash Guru wanna-be cylon's Avatar
    Join Date
    May 2002
    Location
    Galactica
    Posts
    205
    Thanks alot for that pitchdog, muchly appreciated.

    Just to pick your brain even more-so....where is the shared object actually written to on your HDD???
    Say I make a project using shared objects, change the shared object through the flash player, then burn a copy of the swf...will the shard object remain if I play this CD in another computer??
    Just a thought.

    Hope this makes sense.

    Cheers,
    Cylon
    Step away from your monitor<br>go surfing!

  10. #10
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    Cylon,

    I don't know exactally how all of this works ... and I feel I should make it clear that I've never tried this on a mass-produciton level. Just messing around. Still, I'd like to know more.

    This is what I know about the data:

    Here's the data path:
    C:\WINDOWS\Application Data\Macromedia\Flash Player\localhost\hexdata.sol

    Do a search on it ... this is what the data looks like:

    ¿ ]TCSO  HEXDATA act4 pass act2 pass act7 pass act5 pass act3 pass

    So, it looks like you need the player and the data is saved locally and is not attached to the SWF / Player. BTW, I've run this off a standalone / EXE and it works fine.

  11. #11
    Flash Guru wanna-be cylon's Avatar
    Join Date
    May 2002
    Location
    Galactica
    Posts
    205
    Thanks loads for your help.
    But Im still struggling.Ughhh.
    All I really need to get my head around is how to create arrays within a shared object. Im pretty sure you have done this in your land of the lost puzzle(classic!). But Im having probs implementing it in my project.

    This is what Im trying to achieve:
    2 dynamic text boxes. "tb1" and "tb2"

    2 input text boxes. "tb1_edit" and "tb2_edit"

    all I want to do is to be able to use the edit boxes to enter text and to save this text in the corresponding dynamic text box..

    sounds really easy and probably is...but drivin me nuts + giving me rsi!

    I eventually want to make lotsa text boxes and also store variables etc....

    Thanks for any help


    Step away from your monitor<br>go surfing!

  12. #12
    Flash Guru wanna-be cylon's Avatar
    Join Date
    May 2002
    Location
    Galactica
    Posts
    205
    I kinda sussed it out.
    Pls excuse my lousy code.

    But here is where Im stuck.....when I put this swf in a different location (another folder etc)it will not work (recover data from shared object).
    I noticed in the land of the lost puzzle that you specified ("hexdata", "/") when you created your shared object.(I havent seen this documented anywhere)

    I stuck a "/" in but still no go.

    anyways without much further ado heres the fla to show you what Im getting at.

    Cheers p - dog

    btw, I couldnt find the sol file after doing a search....?
    Attached Files Attached Files
    Last edited by cylon; 03-13-2003 at 02:55 AM.
    Step away from your monitor<br>go surfing!

  13. #13
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    Hey Cylon,

    Also like the Land of the Lost, my expertise on shared objects is akin to the humans playing with those ruby hexagons. So, I don't have this worked out in an array, but I have some ideas. I checked out your code and I'm going took another look later today. I do think you should establish the var in the text field as soon as you click the button. I couldn't get that to work until I put a _root. in front of all of the vars. Also, if you can't find the file, I'm guessing its not writting it and I'd start from there. You could also try to see if you can get my hex.fla to display the act or actstatus var in a text field.

    I belive mine works for multiple vars becasue the vars are defined in the hex mc's, so each var is tied to the mc. I don't use an array.

    later.

  14. #14
    Flash Guru wanna-be cylon's Avatar
    Join Date
    May 2002
    Location
    Galactica
    Posts
    205
    Howdy P-dog,
    I ended up creating an array first then assigning that array to the shared object....worked a treat.

    The only thing that I cant figure out (now) is where the shared object is saved. Ive done a search and cannot find any *.sol files.

    anyways...
    What Im trying to achieve is this:
    -edit text boxes as per poo3.swf
    -burn a cd of poo3 and have the local object "follow"

    have you accomplished this?

    CHeers,
    Cylon
    Step away from your monitor<br>go surfing!

  15. #15
    Senior Member pitchdog's Avatar
    Join Date
    Sep 2002
    Location
    Rochester, NY
    Posts
    128
    No new news on this end.

    * I don't think there's anyway the text file will save on the burn.
    * See if you can do a search by last modifed ... if that doesn't work, try to do a search on my hex.

    Here's where it goes everytime I run it.

    C:\WINDOWS\Application Data\Macromedia\Flash Player\localhost

    How new's your code? Let me see it if its any different.

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