|
-
Totally from code?!
Ok, I have been given a task that could win me a very sweet job. I have a week to complete it, and I need to learn some stuff, fast.
I have a library full of images and that's it. I am supposed to make a flash file with a blank stage that creates a dynamic button system completely via code.
How do I do this? Specifically, how do I create a button, an mc, a text field, etc. from scratch, and then how to do I get them to load in dynamic external .swf's without hardcoding? There's no need to duplicate, it's just a previous and next button, and then a button that links to something based on the content I load in.
I'm an ok actionscripter, but this is more advanced than anything I've done before.
Thank you VERY much to whoever helps me on this one.
-
FlashCLUE.com
code: function drawButton( mc, txt ){
mc.clear();
mc.createTextField('t',1,0,-6,100,16 );
var t = mc.t;
t.autoSize = true;
t.text = txt;
t.selectable = false;
mc.beginFill(0xcccccc,100);
mc.moveTo( -2,-8);
mc.lineTo( t._width+2,-8);
mc.lineTo( t._width+2,12);
mc.lineTo( -2,12);
mc.lineTo( -2,-12);
mc.endFill();
}
pr = _root.createEmptyMovieClip('_prev',1);
drawButton( pr, "<< PREV" );
nx = _root.createEmptyMovieClip('_next',2);
drawButton( nx, "NEXT >>" );
pr._y = nx._y = 300;
pr._x = 175;
nx._x = 375;
i = 1;
function loadPic(){
this.pic.removeMovieClip();
var mc = this.createEmptyMovieClip("mc",3);
mc._y = 20;
mc._x = 130;
mc.loadMovie( "http://barada.pl/test/pic/domivic-hon"+this.i+".jpg" );
}
nx.onPress = function(){
this._parent.i == 5 ? this._parent.i = 1 : this._parent.i++;
loadPic();
}
pr.onPress = function(){
this._parent.i == 1 ? this._parent.i = 5 : this._parent.i--;
loadPic();
}
loadPic();
okay, now... did I get your job dude?
-
No, but you might deserve to. 
That all looks pretty understandable, but I never would have figured that out in a week. Thanks a lot.
One question though, this looks like it actually "draws" a button, like with lines and fills...yes? I have images in the library that I need instances of...how do I do that?
-
FlashCLUE.com
 Originally Posted by JoelTHE
No, but you might deserve to. 
go to hell 
 Originally Posted by JoelTHE
One question though, this looks like it actually "draws" a button, like with lines and fills...yes?
yes
 Originally Posted by JoelTHE
I have images in the library that I need instances of...how do I do that?
go to manual looking for attachMovie dude
-
Fine...I should probably find something out on my own, I guess. 
Thanks for all your help.
-
Bearded (M|G)od
My opinion: you probably shouldn't get that job... It's ok to ask for help when working on a project for a client, but its not ok to get someone else to pretty much do the bulk of the work for you to impress a client... They will find out down the road that you're not as good as they thought you were... That's not a good thing... It's better to find clients that you can work with and eventually work up to harder and more complex projects the more you learn...
-
FlashCLUE.com
yeah thats very true - u'll get fired soon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|