A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: load images, load text

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    1

    load images, load text

    Ok, I have a flash file, actually it's the loadimages fun file from http://necromanthus.com/KoolMoves/LoadImages.html
    I want to add dynamic text for each picture by loading a text file. I want the first text file to load on load and every other file to load corresponding with the images. I can get the text to load, but it doesn't keep up with the buttons to go foward and backward. There are five pictures and I have five text files. The first has AC like this and this where the first text sholud show up.

    Code:
    scr._alpha = 0;
    pic = 1;
    input = pic;
    _root.onEnterFrame = function() {
    	if (scr._alpha>10 && fadeOut) {
    		scr._alpha -= 10;
    	}
    	if (scr._alpha<10) {
    		scr.loadMovie("Images/image"+pic+".jpg", "_self");
    		fadeOut = false;
    		fadeIn = true;
    	}
    	if (scr._alpha<100 && fadeIn && !fadeOut) {
    		scr._alpha += 10;
    	} else {
    		fadeIn = false;
    	}
    	if (input>5) {
    		input = 5;
    	}
    	if (Key.isDown(Key.ENTER)) {
    		fadeOut = true;
    		pic = input;
    	}
    };
    
    inputField.onKillFocus = function() {
    	input = pic;
    };
    stop();
    Now the buttons foward AC
    Code:
    on(press){
    	if (pic<5 && !fadeIn && !fadeOut) {
    		fadeOut = true;
    		pic++;
    		input = pic;
    	}
    }
    and back
    Code:
    on(press){
    	if (pic>1 && !fadeIn && !fadeOut) {
    		fadeOut = true;
    		pic--;
    		input = pic;
    	}
    }
    Can anyone help me get this right!
    FYI the images are all image 1,2,3.. and text is txt1, 2, 3..
    A Rainy Night, Soft Jazz by a Warm Fire, Puppy Breath, these are a few of my Favorite Things.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Have your text files be in this format
    &myText=the text describing your photo here
    Assuming your text goes in txt1 object

    change the following
    code:

    if (scr._alpha<10) {
    scr.loadMovie("Images/image"+pic+".jpg", "_self");
    loadVariables("Images/text"+pic+.txt");
    txt1.text=myText
    fadeOut = false;
    fadeIn = true;



    We are not checking that anything is loading but this should work.

  3. #3
    Senior Member indogo's Avatar
    Join Date
    Dec 2005
    Posts
    282
    Using '_alpha' is apparently quite processor intensive which can also throw your timing out..........I was doing a similar thing and made a separate 4 keyframe movie clip which contained a shape to mask over the txt/image...
    The mask (which matches the background) is transparent (using shape properties/fill) in the first and last frame and solid in the middle two.....the second frame loads the next selected image/txt and the movie clip is played each time a new page is called up...adjust timings to give the desired effect.The second to third keyframe allows time to load from the server before fading in.

    The idea was suggested elsewhere on the forum and is a lot simpler ....combine with blanius's format for the files.

    In summary....
    1.static main movie containing image movie clip target and dynamic text box
    2.Movie clip to load data/fade mask.(stop at end)
    3.Buttons to select page and run loading movie clip.

    et voila

    mike

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