Creating A Text Editor in Flash With MDM Zinc

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

8/27/13

Creating a text editor in Flash with MDM Zinc


Forgot your username or passw ord?

Usuario

Contrasea

Enter

o register

Buscar..

Forums Blog Tutorials Courses Videotutoriales Comic

Add a tutorial
Qu quieres buscar?

What is Cristalab?

Tags

Examples

Contact Us

Anime

Search

Tutorials / Creating a text editor in Flash with MDM Zinc

Creating a text editor in Flash with MDM Zinc


By One on April 13, 2007 with 27,061 visits Flash Basic Other Tutorials by One
0
Like

0
Tw ittear

Many people ask in forums and save a txt with flash. Well, with the help of MDM Zinc is very easy. I tried commenting out all the lines of code. Of course you have to have installed the MDM Zinc . opened a new document in Flash and get into the scene one TextArea and 3 Buttons. We would be something like:

Then we assign to each button the following functions: Open Button:

Code:

b o t _ a b r i r.o n R e l e a s e= f u n c t i o n( ) { m d m.D i a l o g s.B r o w s e F i l e.t i t l e= " O p e n ", //T i t l eo ft h ew i n d o w m d m.D i a l o g s.B r o w s e F i l e.b u t t o n T e x t= " O p e n ", //b u t t o nt e x t m d m.D i a l o g s.B r o w s e F i l e.f i l t e r l i s t= " D o c u m e n tT X T|* .t x t ", //O n l ys h o wu st h et x t f i l e N a m e=m d m.D i a l o g s.B r o w s e F i l e.s h o w( ) //O p e naw i n d o wt ol o c a t et h ef i l eo ny o u rh a r dd i s k i f (f i l e N a m e= = " f a l s e ") { //I fw ep r e s sC a n c e lt h e nd on o t h i n g } e l s e { //C h e c ki ff i l ee x i s t s v a rF i l e E x i s t s=m d m.F i l e S y s t e m.F i l e E x i s t s(f i l e N a m e) i f (F i l e E x i s t s= = t r u e) { //I ft h e r ei s ,o p e ni t v a re x t e n s i o n=f i l e N a m e.s u b s t r( -4) .t o L o w e r C a s e( ) i f (e x t e n s i o n= = " .t x t ") { //C h e c kt h a ti sa .t x t t e x t o _ c a r g a d o=m d m.F i l e S y s t e m.l o a d F i l e(f i l e N a m e) ; //c o n v e r tl i n eb r e a k s _ r o o t.t e x t o _ t x t.t e x t=t e x t o _ c a r g a d o.s p l i t(" \r "+" \n ") .j o i n(" \r ") ; } e l s e { //I fn o ta .t x ta l e r tu so u t . m d m.D i a l o g s.p r o m p t(" T h i si sn o tat x t ") ; } } e l s e { //I fy o uh a v en o tc h o s e naf i l e ,a n o t h e ra l e r t m d m.D i a l o g s.p r o m p t(" T h a tf i l ed o e sn o te x i s t ") ; } } } ;

www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/

1/3

8/27/13

Creating a text editor in Flash with MDM Zinc

Save button:
Code:

b o t _ g u a r d a r.o n R e l e a s e= f u n c t i o n( ) { //F i xl i n eb r e a k s v a rs t o r e=_ r o o t.t e x t o _ t x t.t e x t.s p l i t(" \r ") .j o i n(" \r "+" \n ") ; m d m.D i a l o g s.B r o w s e F i l e.t i t l e= " S a v eA s. . . ", //w i n d o wt e x t m d m.D i a l o g s.B r o w s e F i l e.b u t t o n T e x t= " S a v e ", //b u t t o nt e x t m d m.D i a l o g s.B r o w s e F i l e.f i l t e r l i s t= " T X TD o c u m e n t|* .t x t", //O n l ys h o wu st h et x t f i l e N a m e=m d m.D i a l o g s.B r o w s e F i l e.s h o w( ) //O p e naw i n d o wt ol o c a t et h ef i l eo ny o u rh a r dd i s k i f (f i l e N a m e= = " f a l s e ") { } e l s e { //C h e c kt h ee x t e n s i o nt x t v a re x t e n s i o n=f i l e N a m e.s u b s t r( -4) .t o L o w e r C a s e( ) i f (e x t e n s i o n= = " .t x t ") { //I ft h eu s e rh a se n t e r e dac o r r e c te x t e n s i o nt ot h es a v e df i l ep r o c e e d m d m.F i l e S y s t e m.s a v e F i l e U n i c o d e(f i l e N a m e,s a v e) ; } e l s e { //I ft h eu s e rh a sN O Tw r i t i n ga ne x t e n s i o n ,w ea d di tt ot h ef o r c ea n ds a v et h ef i l e m d m.F i l e S y s t e m.s a v e F i l e U n i c o d e(f i l e N a m e+" .t x t ",s a v e) ; } } } ;

Print button:
Code:

l i n eb r e a k s m d m.A p p l i c a t i o n.p r i n t V a r(p r i n t, t r u e) ; //p r o c e e dt op r i n t i n g . } ; We now publish our application and get the.

Swf, as we will see, if you try nothing will happen, but that's because to be compiled with Zinc. opened Zinc, on the "Input File" will see an area called "Input Source "Here we choose our swf. By choosing it you will see that in "Output" by default will put the name of your SWF but with the extension. Exe and you generate in the same folder as your SWF. Finally, we will give the button "BUILD" which is in the lower right corner for you to generate the executable.

We already have our text editor!

[ Example Files ]

Send a comment (27)

Approximate trigonometric sine and cosine functions in Flash

Effect of clouds with Flash 8 BitmapData class

Effect of relief in images with BitmapData in Flash 8

www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/

2/3

8/27/13

Creating a text editor in Flash with MDM Zinc

Download Free PC Software


mobogenie.com/download-pc-software Download Free PC Manager Software. Easy File Transfer. Download Now !

Previous 1

By hari nicol Garcia on May 31, 2012


atodos wave comovan

By Falex the November 2, 2012


and how I can print a datagrid, but I command it prints the name and not the contents of datagrid

Previous 1

Post your comment


Your name: Escribe tu nombre o nick Your comment: Cuentanos en detalle lo quieras opinar Be respectful. Be detailed. Do not write in all caps or like an SMS. Insults, trolls and spammers are always eliminated. [B] bold [/ b] [img] http://url/imagen.jpg [/ img] [url = address] your link [/ url] Publish

or you can ...


Are you registered in Cristalab and want to post your URL and avatar? Sign

Not registered yet but want to do before publishing your comment? Register

Blog

Forums

Tutorials

Flash Tutorials

Examples. Fla

Anime

Videotutoriales

Courses

Flash Course

HTML Course

Tags

www.cristalab.com/tutoriales/crear-un-editor-de-texto-en-flash-con-mdm-zinc-c37783l/

3/3

You might also like