Page 10 of 33 FirstFirst ... 8910111220 ... LastLast
Results 91 to 100 of 327

Thread: new to flash 2004 mx

  1. #91
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Ok, there's nothing wrong with that code. There must be something wrong with either your file structure or your text files.

    Here is a more cleaned up version (though what you posted should work). I get rid of the showThumbs function, the mascots mouse events, the alpha animations and my beautiful comments (why in the world would you want to get rid of them?) *sarcasm*

    Make sure to delete the entire visuals layer. Nothing more, nothing less.

    Code:
    #include "mc_tween2.as"
    
    var images:Array = [];
    var urls:Array = [];
    
    var lv:LoadVars = new LoadVars();
    var lv2:LoadVars = new LoadVars();
    
    lv.onData = function(src:String) {
    	images = src.split("\r\n"); 
    }
    
    lv2.onData = function(src:String) {
    	urls = src.split("\r\n");
    	loadContainers();
    }
    
    lv.load("logos.txt");
    lv2.load("urls.txt");
    
    
    this.createEmptyMovieClip("panel", this.getNextHighestDepth());
    
    var count:Number = 0; 
    function loadContainers() {
    	for(i=0;i<images.length-1;i++) {
    		var symbol:MovieClip = panel.createEmptyMovieClip("symbol"+i, i);
    		var thumb:MovieClip = panel["symbol"+i].createEmptyMovieClip("thumb", i);	
    		var image:MovieClip = panel["symbol"+i]["thumb"].createEmptyMovieClip("image", 30+i);
    
    		panel["symbol"+i]._x = 202*i
    		panel["symbol"+i]._y = Stage.height/4;
    		
    		var mcl:MovieClipLoader = new MovieClipLoader();
    		var mclL:Object = new Object();
    		
    		mclL.onLoadComplete = function() {
    			count++;
    			if(count ==images.length-1) {
    				beginScroll();
    			}
    		}		
    		
    		mcl.loadClip("events/"+images[i], panel["symbol" +i]["thumb"]["image"]);
    		mcl.addListener(mclL);
    		
    		panel["symbol"+i].id = i;
    		panel["symbol"+i].onRelease = function() {
    			trace(urls[this.id]);
    		}
    	}
    }
    
    
    function beginScroll() {
    	var limit = Stage.width - panel._width
    	var time = panel._width / 150;
    	
    	if(panel._x <= limit) {
    		panel.roundedXSlideTo(0, time, "linear", .25, beginScroll);
    	}
    	else {
    		panel.roundedXSlideTo(limit, time, "linear", .25, beginScroll);
    	}
    	
    	panel.onRollOver = pauseResume;
    }
    
    function pauseResume() {
    	delete this.onRollOver;
    	this.pauseTween("_x");
    	var x = panel.getBounds(_root);
    	
    	this.onEnterFrame = function() {
    		if(_xmouse<x.xMin || _xmouse>x.xMax || _ymouse<x.yMin || _ymouse>x.yMax) {
    			this.resumeTween("_x");
    			this.onRollOver = pauseResume;
    			delete this.onEnterFrame;
    		}
    	}
    }
    I've tested this. It does work. So, if you can't get this to work. The problem is 100% with your setup.

    Sorrie, i saw the wrong line medy . its the panel["symbol"+i]._x that controls the sizes. right?
    Nope. That like controls the _x position. You'll get it, eventually (i hope)

    var mclL, what that? i thought that was only something called mcl but i never heard of mclL yet
    Keep readin'! It'll come up. mcl is my variable for a MovieClipLoader object. It doesn't need to be called mcl, that's just what I used because that's what most texts use for examples and I didn't want to confuse you.

    mclL is a MovieClipLoader Listener. With it, you can react to events like onLoadInit (when the actions on the first frame of an imported movieclip are executed) and onLoadComplete (when whatever your importing finishes loaded).

  2. #92
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    Sorrie medy, i only delete the comments when i post here, in the script i still keep it( its very valuable i can`t bear to delete it )

    my beautiful comments (why in the world would you want to get rid of them?) *sarcasm*
    I've tested this. It does work. So, if you can't get this to work. The problem is 100% with your setup.
    OK, i make a new file flash doc then, throw the images etc etc etc into the new flash doc folder. And see how its goes. ( it should be okie provided i DUN mess up the stuff (as usual) Zzz. THANKS for the cleaning up, not sure how i going to return the favour

    Keep readin'! It'll come up. mcl is my variable for a MovieClipLoader object. It doesn't need to be called mcl, that's just what I used because that's what most texts use for examples and I didn't want to confuse you.

    mclL is a MovieClipLoader Listener. With it, you can react to events like onLoadInit (when the actions on the first frame of an imported movieclip are executed) and onLoadComplete (when whatever your importing finishes loaded).
    Sorrie, eh i might be abit short on patience i suppose ( jump to conclusion VERY fast) hehe
    Last edited by hyk; 04-24-2008 at 02:59 AM.

  3. #93
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by hyk View Post
    i only delete the comments when i post here, in the script i still keep it( its very valuable i can`t bear to delete it )
    That's right, how it should be .
    I'm only kidding, of course. Take them out, shift them around, take out the credits too if you want. I only added them for (1) the sake of people that read this thread (yes, all 10+ pages) after your project is over and (2) for the sake of the people I asked to covert it. I didn't want them to think that I was trying to rip off someone else's work.

  4. #94
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    HURRAY, YES its okie already medy. Can i start a Q&A session ( okie medyman, I suppose you WILL scream & mayb add in some colourful* words ) erm at the afternoon i had some errors blah blah( same old story) . I change my images folder name to events & it works now. I suppose its regards to this line. how should i change it to images?

    Code:
    mcl.loadClip("events/"+images[i], panel["symbol" +i]["thumb"]["image"]);
    Okie, if you stop screaming already gulp*, i shall continue.

    1: the direction of the marquee ( need it to scroll in 1 direction without stopping )
    Can i guess the solution, I suppose its related to mc_tween2 ( i need to go read up on the code at the website right?)

    2: the urls file's content, how shall i merge it??

    Oh ya, yesterday you called me to take a look at the split method,do you mind explaining why your code & the website is different ( but yours is shorter of course) Thanks!!!

    http://www.bigroom.co.uk/blog/list-l...actionscript-2

    That's right, how it should be .
    I'm only kidding, of course. Take them out, shift them around, take out the credits too if you want. I only added them for (1) the sake of people that read this thread (yes, all 10+ pages) after your project is over and (2) for the sake of the people I asked to covert it. I didn't want them to think that I was trying to rip off someone else's work.
    If i completed the whole stuff, AND if i know which url is using it, i will post a new thread. ( erm, if i completed there will be a thread & an updated thread if i know which url is using it) PROMISE

    (1) Sorrie to everyone in this forum, i took so much pages (10+ gulp*) without knowing it, & you guys who read it had to bear with my nonsense


    (2) i will thanks those you put in the credits, but the biggest THANKS will go to you medyman
    Last edited by hyk; 04-24-2008 at 09:41 AM.

  5. #95
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    I change my images folder name to events & it works now. I suppose its regards to this line. how should i change it to images?
    Ahh...I forgot to mention that in the configuration steps. Usually, I hold the image paths in a variable, so that's probably why. Anyway, you figured out which line this is on.

    If you want to point to the "images" folder, just change it here:
    Code:
    mcl.loadClip("images/"+images[i], panel["symbol" +i]["thumb"]["image"]);

    the direction of the marquee ( need it to scroll in 1 direction without stopping )
    Can i guess the solution, I suppose its related to mc_tween2 ( i need to go read up on the code at the website right?)
    No, that has nothing to do with MC Tween. You'll have to dive into some ActionScript for that. The easiest way, I think, would be use duplicateMovieClip() with the onTweenComplete method of MC Tween


    the urls file's content, how shall i merge it?
    You can do whatever you want. It doesn't really matter. The simplest would be to set up some sort of delimiter. So, perhaps something like:

    Code:
    image.jpg|http://www.website.com
    *This isn't harder to comprehend than XML


    h ya, yesterday you called me to take a look at the split method,do you mind explaining why your code & the website is different
    It's almost the same thing. The code on the website just broke it down in to several conditionals. I don't check for variations of linebreaks as it's not really needed. Plus the code on the website is a OOP class, so the class syntax makes for more code.


    Sorrie to everyone in this forum, i took so much pages (10+ gulp*) without knowing it, & you guys who read it had to bear with my nonsense
    Oh, come on. I'm trying to for the longest thread about one issue record

    i will thanks those you put in the credits, but the biggest THANKS will go to you medyman
    Huh? That is me in the credits. Believe it or not, my real name isn't Medyman. LOL

  6. #96
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    No, that has nothing to do with MC Tween. You'll have to dive into some ActionScript for that. The easiest way, I think, would be use duplicateMovieClip() with the onTweenComplete method of MC Tween
    k sure, i go read on duplicateMovieClip() & onTweenComplete. got to really read the books for stuffs. few more weeks to submit

    Code:
    	
    	if(panel._x <= limit) {
    		panel.roundedXSlideTo(0, time, "linear", .25, beginScroll);
    	}
    	else {
    		panel.roundedXSlideTo(limit, time, "linear", .25, beginScroll);
    	}
    	
    	panel.onRollOver = pauseResume;
    
    
    }

    eh, i delete the whole bunch of code?then insert the the dulicate etc?

    oh, so i juz to do to the logo text file & it should works right? anymore adding of stuff as etc?

    Oh, come on. I'm trying to for the longest thread about one issue record
    what the number of pages you aiming for? I think i broke the record in the flash section

    Huh? That is me in the credits. Believe it or not, my real name isn't Medyman. LOL
    OH , you are in the credits, hmm i go check it out carefully & pm you your real name. I sure u not medyman in real life( only in this forum)

  7. #97
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    k sure, i go read on duplicateMovieClip() & onTweenComplete. got to really read the books for stuffs. few more weeks to submit
    That's plenty of time. You'll get it. And just think, you'll be a Flash scrolling panel master at the end of it.


    eh, i delete the whole bunch of code?then insert the the duplicate etc?
    Kind of, you'll have to restructure it. What you should do is create 2 panel movieclips at the beginning of the code. Then assign variables to each.

    Next, do some conditionals and see when one is at the right edge of the stage. If it is, position the other one to the right of it and start tweening that one.

    Get the rest of the stuff figured out (one text file) and do this at the end.

    oh, so i juz to do to the logo text file & it should works right? anymore adding of stuff as etc?
    No, no. Why would it be that easy? If you do that, your images array will be this:

    images[0] = "image1.jpg|http://www.website1.com";
    images[1] = "image2.jpg|http://www.website2.com";
    images[2] = "image3.jpg|http://www.website3.com";

    You'll need to further split that (using the split method) and separate it into two arrays -- one for the file names and one for URLs

    what the number of pages you aiming for? I think i broke the record in the flash section
    I don't know...lets see where it goes.

  8. #98
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    You'll need to further split that (using the split method) and separate it into two arrays -- one for the file names and one for URLs
    gulp* so at the start of the script, there the split method( i need to do changes to it?) I thought that was already being done?

    well, going to read that in the weekends

    I don't know...lets see where it goes.
    well i hope it be less than 15 pages, 2 pages for the spliting & 3 for the moving

    okie, i start by by putting the file names etc in the same text file. Hopefully i can do it faster & less errors. need to rush for reports etc

    the moving part i leave it for later den

  9. #99
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Code:
    gulp* so at the start of the script, there the split method( i need to do changes to it?) I thought that was already being done?
    The split is being doing. You still need that. But now, you need to split it further.

    split("/r/n") splits it based on the line breaks. split("|") would split it based on the | delimiter. The easiest way would probably be to loop through the images array, split it, and then push use the Array.push method to construct the two alternate arrays.

    Tip: First create a new .fla and try to get the arrays to work properly. Then try to merge it into the current one.

  10. #100
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Try this:

    Create a new .fla. Save it to the same directory as your text file. Paste the following AS in the actions panel.

    Code:
    var rawdata:Array = [];  //  stores all the raw data
    var images:Array = [];  //  stores symbol image file names
    var urls:Array = [];  //  stores associated website URIs
    
    var lv:LoadVars = new LoadVars();
    
    lv.onData = function(src:String) {
    	rawdata = src.split("\r\n");  // Seperates the raw data based on line breaks.  Output image.jpg|http://www.website.co,
    	for(i=0;i<rawdata.length-1;i++) {   // Loops through all of the raw data
    		info = rawdata[i].split("|");  // Seperates each array element by a delimiter (vertical bar).  Resulting array:  info[rawdata[i]] = (info[0], info[1]) or (image, uri)
    		images.push(info[0]);  // "Pushes" the 0th value (the image path) to the images array for later access
    		urls.push(info[1]);  //  "Pushes" the 1st value to the urls array for later access
    	}
    	
    	testMe();  //  Gotta make sure it works, right?
    }
    
    function testMe() {
    	for(i=0;i<rawdata.length-1;i++) {
    		trace("Raw Data: " + rawdata[i]);  // Rawdata -- as in the text file
    		trace("Image: " + images[i]); // Image path
    		trace("URI: " + urls[i]);  //  URI path
    		trace("");  // Line Break
    	}
    }
    
    lv.load("logos.txt");
    This is only a test. You'll have to figure out how to plug it into your marquee. But it should give you enough ideas about how to go about it.

  11. The Following User Says Thank You to Medyman For This Useful Post:

    ReadyToLearn (05-03-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •