A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Create a simple notepad using flash

  1. #1
    Member
    Join Date
    Oct 2008
    Posts
    31

    Question Create a simple notepad using flash

    Hi. Please could someone help me build a simple notepad (word processor) in flash? Step by step instructions would be very helpful as well as all code given.

    Please could the notepad be able to:

    -edit font format, fontsize, colour etc.
    -save the typed text into a txt file
    -be able to load the file again

    Thanks. I would rather I don't have to mess about with PHP, but use variables instead. If its any help, I'm using Flash 8.

  2. #2
    Programmer
    Join Date
    Aug 2007
    Posts
    173
    Q1) -edit font format, fontsize, colour etc.

    A1) i would do it in HTML. all the above is modifiable with HTML code.
    , so you would have the text box that loads the text set at HTML.


    Q2)-save the typed text into a txt file.

    A2) flash cant save any text(variables) to a .txt file or any local file.
    so to do this you will need to use some 3rd party software. i recommend . swf studio.


    Q3)-be able to load the file again

    A3)

    this will only load a file that is in the same folder as the app is in.

    Code:
    on (release) {
    	import flash.net.FileReference;
    	var listener:Object = new Object();
    	listener.onSelect = function(file:FileReference):Void  {
    		var my_lv:LoadVars = new LoadVars();
    		my_lv.onData = function(src:String) {
    			if (src == undefined) {
    				trace("Error loading content.");
    				return;
    			}
    			thetext.htmlText = src;
    		};
    		my_lv.load(file.name,my_lv,"GET");
    	};
    	listener.onCancel = function(file:FileReference):Void  {
    		trace("User cancelled");
    	};
    	var fileRef:FileReference = new flash.net.FileReference();
    	fileRef.addListener(listener);
    	fileRef.browse();
    }
    make sure you have a dynamic text box with the htmlText render enabled.



    hope this helps you with your project
    Freelance: AS2, AS3, PHP, MySQL, JavaScript
    Skype: hunty93

  3. #3
    Member
    Join Date
    Oct 2008
    Posts
    31
    (A1) Could you give me some specific help with this please? Never used HTML in Flash before?

  4. #4
    Programmer
    Join Date
    Aug 2007
    Posts
    173
    what flash version are you using?.


    ill make an example.
    Freelance: AS2, AS3, PHP, MySQL, JavaScript
    Skype: hunty93

  5. #5
    Member
    Join Date
    Oct 2008
    Posts
    31
    Flash 8

  6. #6
    Programmer
    Join Date
    Aug 2007
    Posts
    173
    OK heres an example for you.

    heres a link for some html codes

    http://www.web-source.net/html_codes_chart.htm


    hope this helps.

    Have fun ^^
    Attached Files Attached Files
    Freelance: AS2, AS3, PHP, MySQL, JavaScript
    Skype: hunty93

  7. #7
    Member
    Join Date
    Oct 2008
    Posts
    31
    Thanks a lot!! Would it be alright if I just copied over bits from your FLA document into my notepad?

  8. #8
    Member
    Join Date
    Oct 2008
    Posts
    31
    Also - how would I tie this formatting in with an input text box?

  9. #9
    Programmer
    Join Date
    Aug 2007
    Posts
    173
    Quote Originally Posted by diewas
    Thanks a lot!! Would it be alright if I just copied over bits from your FLA document into my notepad?

    sure , just try learn something out of it.


    and to make this work in a input box

    make a input box
    enable html text rendering
    call it "livePreview" (unless you modify the script )

    and use this.

    Code:
    _root.onEnterFrame = function() {
    	hunty93 = livePreview.text
    	Ftext  = "<FONT FACE='"+font+"' SIZE='"+size+"' COLOR='"+color+"'>"+hunty93+"</FONT>"
    	livePreview.htmlText = Ftext
    	
    };
    Freelance: AS2, AS3, PHP, MySQL, JavaScript
    Skype: hunty93

  10. #10
    Member
    Join Date
    Oct 2008
    Posts
    31
    Thanks - do you know how to add buttons for underlining, bold and italic?

    Sorry to bother - but 1 last thing, on the buttons that change the colour of the text, the code is "_root.color" , but my text and formatting and colour changing etc. are in a movie clip inside _root . What do I change the code to, to make the colour changes work, as they do not at the moment?
    Last edited by diewas; 11-03-2008 at 05:58 PM.

  11. #11
    Member
    Join Date
    Oct 2008
    Posts
    31

    Question

    Bump.....?

  12. #12
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    Like this?
    http://visualflowdesigns.com/samples...h-text-editor/

    If this is along the lines of what you want to do, I can see if I can find the code for this, or you could always decompile it.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


  13. #13
    Member
    Join Date
    Oct 2008
    Posts
    31

    Thumbs up

    Thanks for replying! Exactly like that example thanks - but without the link stuff at the bottom.

    Is there a way to have all of the fonts available on the person's PC in the font drop down box?

    Thanks for your help.

  14. #14
    Junior Member
    Join Date
    Apr 2012
    Posts
    4

    hey

    i just want to know if you finished that notepad and if you think that it would work on the psp. because if it does i would thank you and please post a link so i can get it

    the psp only runs flash on the .swf format

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