A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: Changing text color in the contact form

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    21

    Changing text color in the contact form

    Hello,
    So basicly I have a contact form with necessity text fields, if it's missed to fill out it turnes to red and when user filling it properly it will go back to normal black color. I'am missing a script for the last part where it's going back to black. Thanks for advance
    Code:
    _root.spare.submit_btn.onRelease=function(){
    	if(mootorIN.text!=''){
    			if(vinIN.text!=''){
    
    		
    		
    	}else{
    		normalText = new TextFormat();
    normalText.color = 0xFF0000;
    clickText = new TextFormat();
    clickText.color = 0x000000;
    _root.spare.star1.text = "*";
    _root.spare.star1.setTextFormat(normalText);
    		error_txt.text='enter your data'
    	}
    		
    	}else{
    		normalText = new TextFormat();
    normalText.color = 0xFF0000;
    clickText = new TextFormat();
    clickText.color = 0x000000;
    	_root.spare.star2.text = "*";
        _root.spare.star2.setTextFormat(normalText);
    		error_txt.text='enter your data'
    
    	}
    	
    }
    And that one is for the send button
    Code:
    on(release)
         { 
    	 _root.spare.star1.setTextFormat(_root.clickText);   
    	 }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Attach your *.fla, save us trying to recreate it

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    I tried, its still 10mb even after deleating all the pics

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Make a small version of the bit you are trying to do perhaps.

  5. #5
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    ok i managed to make it small, uploading now

  6. #6
    Junior Member
    Join Date
    Jan 2014
    Posts
    21

  7. #7
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    Its hard to see but under Menu button there's a another button but it's too bright

  8. #8
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    need Tekst.txt

    nevermind about the text file, so if the text is empty make the star go red, if it is filledd make the star go black again
    Last edited by fruitbeard; 08-01-2014 at 01:01 PM.

  9. #9
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    exactly, you dont need text file. Star needs to go red and black

  10. #10
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I'm not entirley sure what you are wanting, but is this it

    Spare_MC - movieClip script

    PHP Code:
    stop();

    var 
    marks:Array = ["Select one", {data:"alfa"label:"Alfa Romeo"}, {data:"daihatsu"label:"Daihatsu"}, {data:"ferrari"label:"Ferrari"}, {data:"fiat"label:"Fiat"}, {data:"honda"label:"Honda"}, {data:"hyundai"label:"Hyundai"}, {data:"isuzu"label:"Isuzu"}, {data:"kia"label:"KIA"}, {data:"lambo"label:"Lamborghini"}, {data:"lancia"label:"Lancia"}, {data:"lexus"label:"Lexus"}, {data:"maserati"label:"Maserati"}, {data:"mazda"label:"Mazda"}, {data:"mitsu"label:"Mitsubishi"}, {data:"nissan"label:"Nissan"}, {data:"subaru"label:"Subaru"}, {data:"suzuki"label:"Suzuki"}, {data:"toyota"label:"Toyota"}];
    var 
    disabledDP:Array = ["Choose a mark"];
    var 
    alfaNames:Array = ["145""146""147""155""156""159""164""166""1750""2000""33""4C""75""8C Competizione""90""Alfa 6""Alfasud""Alfetta""Arna""Brera""Brera Spider""Giulia""Giulietta""GT""GTV""MiTo""Montreal""RZ""Spider""Sprint""SZ"];
    var 
    daihatsuNames:Array = ["Applause""Charade""Charmant""Copen""Cuore""Domino""F20""Feroza""Fourtrak""Grand Move""Hijet""Mira""Move""Rocky""Sirion""Sportrak""Terios""YRV"];
    var 
    ferrariNames:Array = ["212""246""250""275""308""328""330""348""360""365""400""410""412""456""458 Italia""500""512""550""575M""599""612""California""Dino""Enzo""F355""F40""F430""F450""F50""F512""F620 GT""FF""GTB""GTO""GTS""Mondial""Testarossa"];
    var 
    fiatNames:Array = ["126""127""128""130""132""500""500C""508""600""Albea""Argenta""Barchetta""Brava""Bravo""Cinquecento""Coupe""Croma""Doblo""Ducato""Fiorino""Freemont""Grande Punto""Idea""Linea""Marea""Mirafiori""Multipla""Palio""Panda""Punto""Punto Evo""Qubo""Regata""Ritmo""Scudo""Sedici""Seicento""Siena""Stilo""Strada""Tampra""Tipo""Ulysse""Uno""X19"];
    var 
    hondaNames:Array = ["Accord""Accord Type-R""Airwave""Ascot""Avancier""Ballade""Beat""Capa""City""Civic""Civic Type-R""Concreto""CR-V""CR-Z""Crossroad""Crosstour""CRX""CRX del Sol""Domani""Element""FCX""Fit""FR-V""HR-V""Insight""Inspire""Integra""Jazz""Legend""Life""Logo""Mobilio""NSX""Odyssey""Passport""Pilot""Prelude""Quintet""Ridgeline""S2000""Shuttle""Stream""Thats""Today""Z"];
    var 
    hyundaiNames:Array = ["Accent""Amica""Atos""Azera""Coupe""Dynasty""E3""Elantra""Entourage""Equus""Excel""Galloper""Genesis""Getz""Grandeur""H1""H100""H200""H350""i10""i20""i30""i40""ix20""ix35""ix55""Lantra""Marcia""Matrix""Pony""Porter""Santa Fe""Santamo""Satellite""Scoupe""Sonata""Stellar""Terracan""Tiburon""Trajet""Tucson""Veloster""Veracruz""X2""XG"];
    var 
    isuzuNames:Array = ["Axiom""D-Max""N-seeria""Piazza""Pick Up""Rodeo""Trooper""Turquoise"];
    var 
    kiaNames:Array = ["Besta""Boreggo""Cadenza""Carens""Carnival""cee'd""cee'd GT""cee'd Sporty Wagon""Cerato""Clarus""Forte""Joice""K2500""K2700""Magentis""Mentor""Opirus""Optima""Picanto""Pregio""Pride""pro_cee'd""Retona""Rio""Sedona""Sephia""Shuma""Sorento""Soul""Spectra""Sportage""Venga"];
    var 
    lamboNames:Array = ["Aventador""Diablo""Gallardo""Gallardo Spyder""Huracan""Murcielago""Murcielago Roadster""Reventon""Sesto Elemento"];
    var 
    lanciaNames:Array = ["Beta""Dedra""Delta""Flavia""Fulvia""Gamma""Kappa""Lybra""Monte Carlo""Musa""Phedra""Prisma""Stratos""Thema""Thesis""Trevi""Voyager""Y10""Ypsilon""Zeta"];
    var 
    lexusNames:Array = ["CT 200h""ES 250""ES 300""ES 330""ES 350""GS 250""GS 300""GS 350""GS 400""GS 430""GS 450h""GS 460""GX 460""GX 470""IS 200""IS 220""IS 250""IS 250C""IS 300""IS 350""IS F""LFA""LS 400""LS 430""LS 460""LS 600h""LX 450""LX 470""LX 570""RX 300""RX 330""RX 350""RX 400h""RX 450h""SC 300""SC 400""SC 430"];
    var 
    maseratiNames:Array = ["222""3200""3500""4200""430""5000""Biturbo""Bora""Coupe""Ghibli""GranCabrio""GranTurismo""Indy""Karif""Khamsin""Kyalami""Merak""Mexico""Mistral""Quattroporte""Royale""Sebring""Shamal""Spyder"];
    var 
    mazdaNames:Array = ["121""2""2000""3""323""5""6""626""929""B1500""B1600""B1800""B2000""B2200""B2500""B2600""BT-50""CX-5""CX-7""CX-9""Demio""E1300""E1400""E1600""E2000""E2200""Familia""Millenia""Montrose""MPV""MX-3""MX-5""MX-6""Navajo""Premacy""Protegé""RX-7""RX-8""Savanna""Tribute""Xedos 6""Xedos 9""ZR"];
    var 
    mitsuNames:Array = ["3000""ASX""Canter""Carisma""Celeste""Challenger""Colt""Cordia""Delica""Diamante""Eclipse""Endeavor""FTO""Galant""Grandis""i-MiEV""L200""L300""L400""Lancer""Lancer Evolution""Lancer Ralliart""Mirage""Montero""Outlander""Pajero""Pajero Sport""Raider""RVR""Sapporo""Shogun""Sigma""Space Gear""Space Runner""Space Star""Space Wagon""Starion""Tredia"];
    var 
    nissanNames:Array = ["100 NX""200SX""240SX""280 C""280 ZX""300 C""300ZX""350Z""370Z""Almera""Almera Tino""Altima""Armada""Bluebird""Cabstar""Cherry""Cube""Frontier""GT-R""Homer""Interstar""Juke""King Cab""Laurel""LEAF""Maxima""Micra""Micra C+C""Murano""Navara""Note""NP300""NV200""NV400""Pathfinder""Patrol""Pickup""Pixo""Prairie""Primastar""Primera""Pulsar""Qashqai""Qashqai+2""Quest""Rogue""Serena""Silvia""Skyline""Stanza""Sunny""Terrano""Tiida""Titan""Urvan""Vanette""X-Trail""Xterra"];
    var 
    subaruNames:Array = ["1600""1800""B9 Tribeca""Baja""BRZ""Domingo""Exiga""Forester""Impreza""Impreza WRX STI""Justy""Legacy""Leone""Libero""Outback""STI Racing""SVX""Tribeca""Vivio""WRX STI""XT""XV"];
    var 
    suzukiNames:Array = ["Alto""Baleno""Cappuccino""Carry""Celerio""Grand Vitara""Ignis""Jimny""Kizashi""Liana""Samurai""SC100""SJ410""SJ413""Splash""Swift""SX4""Vitara""Wagon R""X-90"];
    var 
    toyotaNames:Array = ["4-Runner""Aristo""Auris""Avalon""Avensis""Avensis Verso""Aygo""Camry""Carina""Celica""Century""Corolla""Corolla Levin""Corolla Verso""Corona""Cressida""Crown""Crown Majesta""Dyna""FJ Cruiser""GT 86""Hiace""Highlander""Hilux""iQ""Land Cruiser""MR2""Paseo""Picnic""Previa""Prius""ProAce""RAV4""SAI""Sequoia""Sienna""Soarer""Space Cruiser""Starlet""Supra""Tercel""Tundra""Urban Cruiser""Venza""Verso""Verso-S""Wish""Yaris""Yaris Verso"];

    markBox.setStyle("backgroundColor",0xFFFFFF);
    markBox.setStyle("color",0x000000);
    markBox.dropdown.setStyle("backgroundColor",0xFFFFFF);
    markBox.dropdown.setStyle("color",0x000000);
    markBox.dropdownWidth 120;
    markBox.setStyle("borderStyle","solid");
    markBox.setStyle("borderColor",0x000000);
    markBox.setStyle("selectionColor",0x4CE1EE);
    markBox.setStyle("rollOverColor",0xA9EDF3);
    markBox.setStyle("textAlign","left");
    modelBox.setStyle("backgroundColor",0xFFFFFF);
    modelBox.setStyle("color",0x000000);
    modelBox.dropdown.setStyle("backgroundColor",0xFFFFFF);
    modelBox.dropdown.setStyle("color",0x000000);
    modelBox.setStyle("borderStyle","solid");
    modelBox.setStyle("borderColor",0x000000);
    modelBox.setStyle("selectionColor",0x4CE1EE);
    modelBox.setStyle("rollOverColor",0xA9EDF3);
    modelBox.setStyle("textAlign","left");

    markBox.dataProvider marks;
    modelBox.dataProvider disabledDP;
    modelBox.enabled false;
    var 
    cbListener:Object = new Object();
    cbListener.change = function(e:Object)
    {
        var 
    item:Object markBox.selectedItem;
        if (
    item.data == "alfa")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider alfaNames;
        }
        else if (
    item.data == "daihatsu")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider daihatsuNames;
        }
        else if (
    item.data == "ferrari")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider ferrariNames;
        }
        else if (
    item.data == "fiat")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider fiatNames;
        }
        else if (
    item.data == "honda")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider hondaNames;
        }
        else if (
    item.data == "hyundai")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider hyundaiNames;
        }
        else if (
    item.data == "isuzu")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider isuzuNames;
        }
        else if (
    item.data == "kia")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider kiaNames;
        }
        else if (
    item.data == "lambo")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider lamboNames;
        }
        else if (
    item.data == "lancia")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider lanciaNames;
        }
        else if (
    item.data == "lexus")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider lexusNames;
        }
        else if (
    item.data == "maserati")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider maseratiNames;
        }
        else if (
    item.data == "mazda")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider mazdaNames;
        }
        else if (
    item.data == "mitsu")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider mitsuNames;
        }
        else if (
    item.data == "nissan")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider nissanNames;
        }
        else if (
    item.data == "subaru")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider subaruNames;
        }
        else if (
    item.data == "suzuki")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider suzukiNames;
        }
        else if (
    item.data == "toyota")
        {
            
    modelBox.enabled true;
            
    modelBox.dataProvider toyotaNames;
        }
        else
        {
            
    modelBox.enabled false;
            
    modelBox.dataProvider disabledDP;
        }
    };
    markBox.addEventListener("change",cbListener);

    _root.spare.submit_btn.onRelease = function()
    {
        
    normalText = new TextFormat();
        
    normalText.color 0xFF0000;
        
    clickText = new TextFormat();
        
    clickText.color 0x000000;

        if (
    mootorIN.text != '')
        {
            
    _root.spare.star1.text "*";
            
    _root.spare.star1.setTextFormat(clickText);
        }
        else
        {
            
    _root.spare.star1.text "*";
            
    _root.spare.star1.setTextFormat(normalText);
            
    error_txt.text 'enter your data';
        }
        if (
    vinIN.text != '')
        {
            
    _root.spare.star2.text "*";
            
    _root.spare.star2.setTextFormat(clickText);
        }
        else
        {
            
    _root.spare.star2.text "*";
            
    _root.spare.star2.setTextFormat(normalText);
            
    error_txt.text 'enter your data';
        }
    }; 

  11. #11
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    Oh thank you fruitbeard so much, everything works perfectly.

  12. #12
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    A quick questinon regarding text file. If I want to do same thing only with textArray, should I use same way as with stars. Because I tried to add that
    PHP Code:
            _root.spare.error_txt.text _root.textArray[sectionNum][14]; 
    and I got only undefined message.

  13. #13
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Whats written inside tekst.txt would help this time.

  14. #14
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Try _root.spare.error_txt.text = _root.textArray[_root.sectionNum][14];

    you seem to be calling _root a lot when you dont need to call it from within, unless its outside of the clip like the sectionNum var and the array, the error text is inside the movieclip, it still works though.

  15. #15
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    Hey,
    Yep it seems weird that theres so many _roots but somehow your code is working. I don't know if there's a simple way to do that, with less roots. I'll attach my text file, maybe it will help to clear things out.Tekst.txt

    But that one worked fine
    PHP Code:
    _root.spare.error_txt.text _root.textArray[_root.sectionNum][14]; 

  16. #16
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Basically all you need to write is error_txt.text = _root.textArray[_root.sectionNum][14]; as the code is inside the movieclip called spare on the timeline.
    The array is in the _root and so is the sectionNum var.

    same with these and the others like it

    _root.spare.star1.text = "*";
    _root.spare.submit_btn.onRelease = function()
    _root.spare.star2.text = "*";

    need only be

    star1.text = "*";
    submit_btn.onRelease = function()
    star2.text = "*";

  17. #17
    Junior Member
    Join Date
    Jan 2014
    Posts
    21
    That makes sense. Thank you fruitbeard

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