well i still a newb on the learning curve of as3...i would appreciate and great
full
to those that can help me with this...
i did most of the art work just it ain't working like expected so hoping for
information on how to solve this puzzle...
i want my button when pressed to load a text box in current frame; but when i
press the same button again that it closes it the textbox or makes it
vanish(faeaway..etc)
thank you very much for assistance
Varun Upadhyay - 01 Jul 2008 07:33 GMT
Hi,
Write this code for CS3:
package{
import flash.text.*;
public class Draw extends Sprite {
private var maketextFlag:Boolean;
var txt:TextField = new TextField();
public function Draw(rootObj:Object){
maketextFlag = new Boolean(true);
rootObj.sample_btn.addEventListener(MouseEvent.MOUSE_DOWN,fnMakeText);
}
function fnMakeText(e:Event):void {
if (maketextFlag) {
txt.text = "Hello User";
rootObj.addChild(txt);
maketextFlag = false;
} else {
rootObj.removeChild(txt);
maketextFlag = true;
}
}
}
elyelyely - 01 Jul 2008 12:36 GMT
thank you
do i dump it directly into my flash cs3 ..remember i am much a designer then a
devy so confused here how to make it work sorry...
i have the button made and movieclip(text made...each with their instance
name...
so how i addf your code to this all please help me on this..
thank you
Varun Upadhyay - 02 Jul 2008 06:42 GMT
No problem....
1. Just make a new Flash class file named as "Draw.as".
2. Don't put this as in any folder otherwise you need to change the code also.
if neccessary to put this as in any folder then let me know.
3. Write following code in Flash frame where your button and text palced:
var obj:Draw = new Draw(this);
4. Button name, as of my code, should be "sample_btn";
5. I made a dynamic text here. Just check that, if that will be as your
requirment, then i will make code as per your fla.
Regards,
Varun Upadhyay
elyelyely - 02 Jul 2008 07:00 GMT
thanks Varun Upadhyay as it does work..had to twitch and itch things around to
make it work but it did....
i am wondering if can help me solve another riddle in asc3 flash cs3...
i did the coding and work to load a random background...
meaning i have three different backgrounds setup with obvious other works of 5
different layers in the .fla
the issue is if i had one layer with the 3 backgrounds + the asc3 it would
work ...BUT when i load the it with the other layers and different works it
just doesnt work ...
doesnt give errors but just doesnt load things random ..like never see thirs
background or always see the second or a blank screen sometimes appeares... as
i cant attach a file here PLEASE go to this link if have time see the atachment
and if you can help in resolving this with me...
thanks here it is my friend
http://www.actionscript.org/forums/showthread.php3?t=175747
Varun Upadhyay - 02 Jul 2008 07:53 GMT
hi i am posting a new flash file in the given link. check that.
I also frustated y this gotoAndPlay is not working properly in AS3. Anyways just check that file and let me know.
elyelyely - 02 Jul 2008 12:36 GMT
well thanks again as always ...your method works but i have to turn everything
into a movie and also into one overlapping first frame....
is there a method in your way where if i had 3 different backgrounds in one
layer instead frame..like you saw in mine...
very odd the goto dont work....
Varun Upadhyay - 03 Jul 2008 07:11 GMT
Hi elyelyely, i tried with your flash file. and when i removed
Background(frameset, frameset2, frameset3) then flash workes fine. it means
there is problem to load so heavy images.
Do one thing.... Load these images dynamically in respective frame.
Regards,
Varun Upadhyay
elyelyely - 03 Jul 2008 08:05 GMT
to make sure it works you say load three backgrounds from one frame on timeline
and not three different frames....
this sux as didnt know asc3 had its limitation or code i am using is
primitive...
doesnt make sense i use limited to almost no graphics it works but if use
graphics heavy it goes bonkers....
hmmm i would put it a bug in the flash cs3 books....
i am wondering is there another method to do it ...
Varun Upadhyay - 03 Jul 2008 08:20 GMT
Try with low size images as background, otherwise load images at runtime.
elyelyely - 03 Jul 2008 16:55 GMT
dont take me the wrong way but what you mean by runtime.....