Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Newbie Actionscript Help



new to the boards and actionscript more or less.i am using flash mx pro 2004 and
i am trying to make a draggable graphic that drags when you hold down the mouse button..but i am trying to get it to snap back over the graphic it is revealing once the mouse is released...i am using the following script:
onClipEvent(mouseDown){if(this.hitTest(_root._xmou se,_root._ymouse,false)){this.startDrag(lockCenter );
}
}
onClipEvent(mouseUp){if(this.hitTest(_root._xmouse ,_root._ymouse,false)){this.stopDrag();
}
}
it works aside from not being able to get it to snap back....any help is greatly appreciated thanks in advance



FlashKit > Flash Help > Flash ActionScript
Posted on: 02-10-2005, 05:46 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Newbie Needs Help With Actionscript
does any one know were you can find a complete tutorial on leaning actionscript if you know were one is ppppplllllleeeeeaaaaasssseee(please) help

For Every Actionscript Newbie
everyone should now a bit bout object oriented programming:

http://www.debreuil.com/docs/ch01_Intro.htm

Newbie Actionscript Help
I'm trying to creat a gameboard grid with actionscript. I need to on load have a blue movie square duplicate itself into a 5 x 6 grid, each movie assigning itself a name so I can manipulate them later

also I have a dynamic text box that will also duplicate itself on top of those blue squares while feeding a text array into these boxes as they deploy. Again assigning themselves Id so I can manipulate them later.

It might be easier to imagine it a jeopary board, because that's what I'm creating... but I'm new at this, so a few snippets of help or ghosting code would help.

thanks.
RICK!

Actionscript Newbie Needs Help
I know this can be done, but nothing I've tried has worked consistently.
Flash MX Mac

I am loading a slideshow.swf into an empty mc in my main movie.

The movie I'm loading is the same size as the main movie (don't want to see anything below it).

After clicking through the slideshow.swf, I want to have a "close" button that removes the slideshow.swf and allows the user to select something else on the main movie nav.

What script do I use? Do I apply it to the "close" button in the slideshow.swf or do something inside the main movie?

Thank you in advance, I know someone out there can straighten me out.

Newbie Needs Help With Actionscript
I am trying to 1) dynamically create a movie clip, and then within that mc, 2) dynamically create a series of questions followed by input boxes for answers.

Variables supply information such as the number of questions (numq), text of the questions (eg., question1), and the size/height the response box should be for that question (eg., response1size).

Below is my code, which is a patchwork of several examples I have seen online and posts on this forum. Right now my FLA consists only of this code and a gray background, but on test/publish it produces nothing (except, of course, the blank gray background).

Can anyone take a look and tell me what needs fixin'?

numq = 3;
question1 = "Question 1...?";
question2 = "Question 2...?";
question3 = "Question 3...?";
response1size = 2;
response2size = 5;
response3size = 9;
currY = 0;

_root.createEmptyMovieClip ("qa", 0);

for(ivar=1;ivar<=numq;ivar++){
qa.createTextField ("tboxquestion"+ivar, ivar+numq, 0, _root[currY], 100, 50);
qa.tboxquestion.type="dynamic";
qa.tboxquestion.text=_root["question"+ivar];
currY += 200;
rsize=20*_root["response"+ivar+"size"];
qa.createTextField ("tboxanswer"+ivar, ivar+2*numq, 0, _root[currY], 100, rsize);
qa.tboxanswer.type="input";
qa.tboxanswer.border= true;
currY += 200;
}

A static-text example of what I am shooting for is at:

http://www.sunsetonline.org/post_example.html

Newbie In Actionscript.
I am newbie in actionscript and learning it... i just saw a website... it has a great actionscripted flash brochure...

Edit : Problem solved

thanks

Newbie In Actionscript.
I am newbie in actionscript and learning it... i just saw a website... it has a great actionscripted flash brochure...

Edit : Problem solved

thanks

Some Newbie Actionscript Help.
I'm using This tutorial. It says to put This code in my movieclip

Code:
onClipEvent (mouseMove) {
xmousepos1 = _xmouse;
ymousepos1 = _ymouse;
if (xmousepos1>xmousepos2 && ymousepos1>-98 && ymousepos1<-33) {
_root.scrollclip.nextFrame();
}
if (xmousepos1-98 && ymousepos1<-33) {
_root.scrollclip.prevFrame();
}
if (ymousepos1<-98 || ymousepos1>-33) {
play ();
}
xmousepos2 = _xmouse;
ymousepos2 = _ymouse;
}

On the last page of the tutorial, it goes into those 2 numbers, and that I will have to change them based on my creation. So... I left them alone and tried it out, it's not working. I checked the comments on it as well, but they don't say anything about those numbers. What do they mean? How can I get mine to work? I'm using images as well, but my canvas is differnt size.. I think that may be the problem. My canvas is 2645 x 170 px.


Any help will be GREATLY apprecitated. Thank you very much,
Matt

Actionscript Newbie Needs Help - Please?
Hello -

While I have been using Flash for over 4 years, I have not had the opportunity to really utilize Actionscript. Over time, I have been trying to teach it to myself. I am looking into some tutorials and classes.

However, now I am in a real situation that I desperately need help with. A long time freelance client of mine has a Computer Based Training (CBT) piece that was originally designed in Flash by someone other than me.

This client now wants to make revisions to the CBT. It is like doing private investigation work trying to locate files and understand the way they named everything.

I am trying to get to a MC but I canot find it in the library. This is a MC that plays when the navigation button is clicked. The Actionscript for the button says:

on (release) {
with (_root) {
gotoAndPlay("Module3", 1);
}
}

I have no clue what it means after on (release). I guess I need to find Module3 in order to update that MC but I do not see anything that says Module3 in the library? I am so confused. I am unable to post the FLA file because this is proprietary information as it pertains to software developed by the client.

Any help is greatly appreciated.

Denise

[F8] - Actionscript Newbie
Hello all. I am extremely new to actionscript in flash. i have a background in technical writing and am moving more in the direction of Flash Developer. I have very little experience coding and the like.

Therefore, got couple of questions.

1. Recommended books to read to help learn actionscript.
2. I found a tutorial about a rain effect. In the tutorial, it says to add provided actionscript to the "Head section of your page." What does this mean?

Thanks.

Actionscript Newbie
Dear All

I have downloaded an fla file that mimics the Matrix text affect you see in
the film of the same name. I get the following error on the line "fade add i
add .font.letterfield = substring (line1,i,1)":

**Error** Scene=Page 1, layer=Scripts27, frame=7:Line 19: Operator 'add'
must be followed by an operand fade add i add .font.letterfield = substring
(line1,i,1)

I have looked into this issue and I partially understand the problem, but I
would not know where to start. I have attached the full frame code and I
would appreciate any feedback from the group.

Thanks again...

Alastair MacFarlane

kerning = kerningbasis * s1 / 100
kerningvar = s1 / 100
if (1 < line1.length) {
gotoAndPlay(7)
} else {
gotoAndPlay(6)
}
setProperty ("letter",_y,yposstart)
setProperty ("letter",_yscale,s1)
setProperty ("letter",_xscale,s1)
setProperty ("letter",_visible,false)
if (i < line1.length + 1) {
duplicateMovieClip ("fade",fade add i,200 - i)
fade add i add .font.letterfield = substring (line1,i,1)
randy = random(300) - random(300)
scaley = random(100) - random(100)
setProperty (fade add i,_y,yposstart)
setProperty (fade add i,_x,xposstart + i * kerning + rand)
setProperty (fade add i,_yscale,scaley)
setProperty (fade add i,_xscale,s1)
}
duplicateMovieClip ("letter",lettera add i,i)
lettera add add .font.letterfield = substring (line1,i,1)
setProperty (lettera add i,_x,xposstart + i * kerning)
i = i + 1
if (eval("lettera" + line1.length)._currentframe == 85) {
gotoAndPlay(9)
}

Actionscript Help. Newbie
Hiya, I asked a question similar to this one a few days ago to which FlashTastic kindly helped out with, however unfortunatly the miclevel is not working, I'm more or less a complete actionscript newbie. So I was just hoping if someone could have a look over this and see what the problem is. I have combined the AS I was using first with the one Flashtastic provided, and this is what I have now. If you would like to see the A.S flasttastic provided and the one I was using at first then please go here, Thank for any help.







Attach Code

var $activityTimer:Number;
m = Microphone.get();
attachAudio(m);
m.setUseEchoSuppression(false);
s = new Sound(this);
s.setVolume(0);
m = Microphone.get();
attachAudio(m);
checkActivity = function(micLevel):Void{

if (micLevel <30){
circle._xscale = circle._yscale = m.activityLevel+0;
circle._alpha = 90;
}

else if((micLevel >30) && (micLevel <50)){
yell._xscale = yell._yscale = m.activityLevel+0;
yell._alpha = 90;
}

else if((micLevel >50) && (micLevel <70)){
green._xscale = green._yscale = m.activityLevel+0;
green._alpha = 100;
}

else if(micLevel >70){
red._xscale = red._yscale = m.activityLevel+0;
red._alpha = 60;

p1._xscale = p1._yscale = m.activityLevel+10;
p1._alpha = 100;
}
}

$activityTimer = setInterval(checkActivity,100,m.activityLevel);

ActionScript Newbie Needs Some Help
Hi to anyone and everyone-

This should be pretty simple, but I don't know where to start. I need to put together some actionscript that will randomly load one of the images in my library each time the site comes up. I have the linkage assigned to each picture (right now they are IMG1 thru IMG10), but I don't know how to a.) get Flash to recognize that those are the pictures I want to deal with, and b.) randomly load one each time the site is opened (or the main page is revisited, or whatever).

If you can help me out, it would be greatly appreciated!
Thanks!

Actionscript Newbie
Hi,

I'm new to Flash and I'm trying to learn action script by making simple games. One game I'm working on has a user-controlled object (a bug) moves from the bottom of the screen to the top (arrow keys). At the same time, moving across the screen, from left to right, are blocks the user must avoid hitting. Everything works great until the user-controlled bug hits hits a block. I used a hitTest command within an if statement. Everything executes when the condition is true (a hit) except the stop command...the movie keeps running. I have the entire script attached to the bug which is on the main timeline. The blocks that move across the screen move in their own timelines. Any help? (I don't know if I've provided enough info.)

Scigolf

ActionScript Newbie
I need your help guru's im on a rush!

How can my movie go to a specific frame with "load movie".
I have a button, here is the action that I have on by button:

Code:
on (release) {
loadMovieNum("real.swf", 0);
gotoAndStop(5);
}
When clicked, the button loads the movie correclty but in the first frame. I want my button to lead to the frame 5. How can I do that?

Thx

Newbie Actionscript
Hey guys nice forums!

I'm new to flash and I would like to know how I would go about making little animated trails of "microdata"(or puffy white lines) move back and forth across this microchip graphic I made... Lines need to be random in movment across the microchip. I'm brand new to actionscript which is really preventing me from creating anything interactive or creative.


Heres a screenshot of the (so-called) micro chip i need this to happen on - http://roccocastoro.tripod.com/microchips.gif (Copy and paste link in browser....

I know I've seen this effect on a different site somewhere but I can't remember - anyone else know>?

Thanks,
Roc

Actionscript Newbie Help
hi everyone!

i've been doing a little movieclip which has the following actionscript:


ActionScript Code:
onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._xmouse-this._x);
 myDegrees = Math.round((myRadians*180/Math.PI));
 _root.xChange = Math.round(_root._xmouse-this._x);
 _root.xMove = Math.round(_root.xChange/5);
 this._x += _root.xMove;
 }


it basicaly follows the pointer in the x direction. i've put this together from a tutorial file but im not this good at actionscript. my problem is that i need this movieclip to only work on a specific area i can specify through x and y coordinates. can anybody help me with it?

thanx

Newbie With Actionscript Questions
hello, newbie here to flash using MX, and i have a couple of questions: first off, i have a movie where frame 1 there are 3 buttons. no matter which button is pushed, the next 30 frames or so played will be the same, but the ending frame will be different. how do i get frame 30 to remember which button was pushed back on frame 1 so as to jump to the correct last frame? i don't want to have 3 copies of the 30 frame movie since that takes up so much space, which is why i want the same one playing for all 3 buttons. ALSO, on a different project, i have a simple movie of a guy floating down a river with a tree branch coming up, and i want the user to be able to push a particular letter on the keyboard within 5 frames of the branch and the guy will duck, else if nothing is pushed the guy hits the branch and falls in the water. i can do everything but the key recognition, how do i get it to look for the key press during those 5 frames and then jump to the right scene at the end of the 5 frames if the key press was found? i have little to no experience with actionscript, so please walk me through the process gingerly for both of these questions!

Rotation With Actionscript - NEWBIE
I'm trying to rotate an object slowly around its center and tweening just doesn't go slow enough. The tween currently runs over 400 frames and that's just far too many, especially when I'm sure that Actionscript would be able to do it alot easier and smoother.

Only problem is that I don't know much actionscript past the standard gotoandplay etc so could anyone let me know the best way to go about this or point me to a site where I could learn basic movement by using actionscript please.

To give a clearer idea of what I'm trying to do click here

Each of these symbols will be opening up a page on the site. Ideally I'd like to have the rotation stop each time one of the symbols is clicked on. For now though I'd just like to know how to rotate using Actionsript cos I know what I'm like, newbie confusion etc.

Hope someone can help. Thanks

Newbie Question About Actionscript
Arial
Hi, I've just registered here,and I hope I can be part of this freindly community.

I have a newbie question about actionscript... hope you guys will not laugh at my ignorance! But where do you actually put the code into??? For example, a tutorial gives you a string of variables or code, so you copy it, then where do you put it into? I'm using Flash MX.

Thx in advance!

Newbie Actionscript Problem
Hi - I am having trouble with 3 functions... I need them all to run, but if I place them all in the same layer, only one works... if I place them in different layers, again, only 1 works!

Do I need to combine them somehow?

Here is the code :

this.onLoad = function() {
mySoundLoading = 0;
_root.loadBar._xscale = mySoundLoading;
};
//END onLoad

this.onEnterFrame = function() {
mySoundBytesTotal = _root.myMusic.getBytesTotal();
mySoundBytesLoaded = _root.myMusic.getBytesLoaded();
if (preloadNow == 1 && mySoundBytesLoaded>0) {
mySoundLoading = Math.round((mySoundBytesLoaded/mySoundBytesTotal)*100);
_root.percentLoadedText = mySoundLoading+"% of track loaded";
_root.loadBar._xscale = mySoundLoading;
if (mySoundLoading == 100) {
preloadNow = 0;
}
}
};
//END onEnterFrame

this.onEnterFrame = function() {
if (clip.getvalue() != "") {
if (stopped != true) {
myMusicDurationText = myMusic.duration/1000;
myMusicPositionText = myMusic.position/1000;
fadeEnd = (songDuration-5);
}
loadedSong = songMusic;
if (fadeEnd<=songPosition && myMusicVolume>0 && playing == true) {
if (myMusicVolume<=1) {
myMusicVolume = 0;
}
_root.myMusic.setVolume(myMusicVolume);
myMusicVolume = myMusicVolume-1;
}
//
//Reverse
if (REV == 1 && myMusicPosition>0) {
_root.myMusic.stop();
myMusicPosition = myMusicPosition-.5;
_root.myMusic.start(myMusicPosition, 0);
}
revButton.onPress = function() {
REV = 1;
myConditionText = "Rewinding";
myMusicPosition = _root.myMusic.position/1000;
//
};
revButton.onRelease = function() {
REV = 0;
myConditionText = "Playing";
playing = true;
};
//Fast Forward
if (FF == 1 && myMusic.position<myMusic.duration) {
_root.myMusic.stop();
myMusicPosition = myMusicPosition+.5;
_root.myMusic.start(myMusicPosition, 0);
}
FFButton.onPress = function() {
FF = 1;
myConditionText = "Forwarding";
myMusicPosition = _root.myMusic.position/1000;
};
FFButton.onRelease = function() {
FF = 0;
myConditionText = "Playing";
playing = true;
};
}
//
};
this.onEnterFrame = function() {
myMusicDuration = _root.myMusic.duration/1000;
myMusicPosition = _root.myMusic.position/1000;
fadeEnd = (myMusicDuration-5);
if (fadeEnd<=songPosition && myMusicVolume>0 && playing == true) {
if (myMusicVolume<=1) {
myMusicVolume = 0;
}
_root.myMusic.setVolume(myMusicVolume);
myMusicVolume = myMusicVolume-1;
}
};

Help would be much appreciated!

Cheers, Steve

Newbie Actionscript Problem
Hi - I am having trouble with 3 functions... I need them all to run, but if I place them all in the same layer, only one works... if I place them in different layers, again, only 1 works!

Do I need to combine them somehow?

Here is the code :

this.onLoad = function() {
mySoundLoading = 0;
_root.loadBar._xscale = mySoundLoading;
};
//END onLoad

this.onEnterFrame = function() {
mySoundBytesTotal = _root.myMusic.getBytesTotal();
mySoundBytesLoaded = _root.myMusic.getBytesLoaded();
if (preloadNow == 1 && mySoundBytesLoaded>0) {
mySoundLoading = Math.round((mySoundBytesLoaded/mySoundBytesTotal)*100);
_root.percentLoadedText = mySoundLoading+"% of track loaded";
_root.loadBar._xscale = mySoundLoading;
if (mySoundLoading == 100) {
preloadNow = 0;
}
}
};
//END onEnterFrame

this.onEnterFrame = function() {
if (clip.getvalue() != "") {
if (stopped != true) {
myMusicDurationText = myMusic.duration/1000;
myMusicPositionText = myMusic.position/1000;
fadeEnd = (songDuration-5);
}
loadedSong = songMusic;
if (fadeEnd<=songPosition && myMusicVolume>0 && playing == true) {
if (myMusicVolume<=1) {
myMusicVolume = 0;
}
_root.myMusic.setVolume(myMusicVolume);
myMusicVolume = myMusicVolume-1;
}
//
//Reverse
if (REV == 1 && myMusicPosition>0) {
_root.myMusic.stop();
myMusicPosition = myMusicPosition-.5;
_root.myMusic.start(myMusicPosition, 0);
}
revButton.onPress = function() {
REV = 1;
myConditionText = "Rewinding";
myMusicPosition = _root.myMusic.position/1000;
//
};
revButton.onRelease = function() {
REV = 0;
myConditionText = "Playing";
playing = true;
};
//Fast Forward
if (FF == 1 && myMusic.position<myMusic.duration) {
_root.myMusic.stop();
myMusicPosition = myMusicPosition+.5;
_root.myMusic.start(myMusicPosition, 0);
}
FFButton.onPress = function() {
FF = 1;
myConditionText = "Forwarding";
myMusicPosition = _root.myMusic.position/1000;
};
FFButton.onRelease = function() {
FF = 0;
myConditionText = "Playing";
playing = true;
};
}
//
};
this.onEnterFrame = function() {
myMusicDuration = _root.myMusic.duration/1000;
myMusicPosition = _root.myMusic.position/1000;
fadeEnd = (myMusicDuration-5);
if (fadeEnd<=songPosition && myMusicVolume>0 && playing == true) {
if (myMusicVolume<=1) {
myMusicVolume = 0;
}
_root.myMusic.setVolume(myMusicVolume);
myMusicVolume = myMusicVolume-1;
}
};

Help would be much appreciated!

Cheers, Steve

Uhh...help? A Newbie Prob In Actionscript
Okay, i have a newbie problem here. I have been trying to figure out for days how to play a movie. OKay, let me specify. I have a button in the main timeline, layer one, and i have a movie clip on the same place as the button. What i want to do is assign the button the function that when you click on it, it plays the movie clip which is like a spreading background...am i making sense? can someone help? thanks...

Actionscript Help For Newbie Needed
I have just started learning flash actionscript because I need an alternative to PHP for offline use. This code below has pretty much been ripped out of my working PHP script, with a few changes, but doesn't seem to work. I think it is something to do with getting the selected data from combo boxes.. Anyways, can anyone talented in ActionScript try and find why this is giving a totally whack result:

//
on (release) {
var house_age = house_age_form.getSelectedItem().data;
var garage = garage_form.getSelectedItem().data;
var shed = shed_form.getSelectedItem().data;
var pool = pool_form.getSelectedItem().data;
var spa = spa_form.getSelectedItem().data;
var pergola = pergola_form.getSelectedItem().data;
var decking = decking_form.getSelectedItem().data;

house_agetwo = house_age+added_value-lowered_value;
house_value = house_size*house_agetwo;

if (shed == nshed) {
shedtwo = 0;
}
if (shed == yshed) {
shedtwo = shed_cost/2;
}

if (pool == nopool) {
pooltwo = 0;
}
if (pool == agp) {
pooltwo = 1000;
}
if (pool == igp) {
pooltwo = pool_cost/2;
}

property_estimate = house_value+land_value+garage+shedtwo+spa+pooltwo+ pergola+de
cking+extras;
property_estimate = math.round(property_estimate);
}
//

thanks

Few Newbie Actionscript Questions.
I'm making an action battle system in Flash and got a few questions.

Teleport:
When you teleport to the next frame, how can I position the character through x & y coordinates? I tried name._x=number; and name._y=number; but it doesn't work.

Placing an object over another object through x-y coordinate memorization:


This screenshot says it all. I want to be able to have that cast animation be positioned ontop of the character but don't know how.



Thanks for the help. Very much appreciated.

Newbie ActionScript Question
I have a .swf that is being popped up from a web-page, and I want to have a close window button. However, I have not found any actionscript to close the window.

Any tips?

Thanks a lot

Sean

Actionscript Philosophy (newbie
hoi,

i still don't understand actionscript philosophy...

i just made an intro- with a bunch of simple tweens, and once in a while a background image(approx. 65kb)fading in and out etc, but its goin sooo slow and jittery (online).
Would actionscripting all this make it run significantly smoother?

More specifically, my site's background has a tween of 2bars moving about masking an image(65kb) on top of another image (65kb), but this totally slows all navigation. i've seen other sites do this with no problem-.. is this solved with actionscript?

cheers for any help

Newbie Actionscript Question
Sorry for the probably stupid question...
But anyway, here it is:

I've got this function in the _root frame.
The function is being used by an object in _root.texte (_root.texte.Pic1).
the problem is in seting the name variable.
Please take a look and tell me what is wrong and how should i fix it. thanx

function specin(current, all) {
n = 1;
while (all>0) {
name = _root.texte+"."+n;
if (name = current) {
all--;
n++
}
else {
tellTarget (name) {
_alpha = 70;
}
all--;
n++;
}
}
}

Total Newbie To ActionScript.
Can anyone suggest a good book, or even better a good online tutorial?

I'm confused at how time works in relation to actionscript.

IE. If I do:

onClipEvent (enterFrame)
{
this._alpha += 3;
}

and then went to do a:

this._alpha -= 3;

right afterwords to fade it back out.. This absolutely does not work.. So how do I track time in ActionScript and kick another event off once the first one has finished?

..or am I making this harder than it actually is?

Thanks!

Newbie Question About Actionscript
Hey I would like anyones help with actionscript code. I am a newbie to actionscripting. I was wondering if anyone could show me a script for a platform game. Mostly I need help with collision and enmies.


Ex: The hero walks into a marker (small invisible square)and a help or hint text pops up on the screen.

I am trying to make a megaman type game.

(actionscript Newbie) URGENT
Hello. Please help. I have to get this done. I am trying to load and target a movie clip from an already loaded movie clip. I basically have the main stage that loads another swf (nextClip) into a container clip. When it loads it is invisible. A button (on_btn) makes this clip visible. That button resides on the main stage. I have that part figured out.

What I want to do next is load another swf (extraClip) into another container clip within this already loaded swf (nextClip). This new clip (extraClip) has a blank keyframe in frame one with a stop action. What needs to happen is that when nextClip becomes visible, extraClip goes to frame 2 and plays.

I recently switched to MX2004 and this is becoming a real bugger. I know "if then" states must be used as well as tellTarget or targetPath. I'm not sure what this actionscript should look like since it involves a condition. And I'm not sure where the movies need to load. Do the all load in _root? I don't want to overburden the first frame of the main stage with actions.

I don't expect anyone to write out any indepth actionscript here. If you can that will be much appreciated. However, if you can just point me to a link or source that explains this in detail that would work as well. I hope this was explained clearly enough. Thank you for reading all of this and for your time.

The following following file contains 4 FLAs and 4 SWFs. Everything is in MX ONLY format.

Happy Halloween!

Newbie Actionscript Questions - Help Please
hi everyone

i am building my flash site using server side scripts i.e PHP/MySQL database.

Now i have figured out how to display content from my DB into my flash movie, even images!! Whoo i am good - joke

Anyway, my questions are as follows:

QUESTION 1: can i add separate pre-loaders for the content being loaded from the DB i.e. images, text, or is there a way to make 1 pre-loader for all the DB content and only display it once its ALL been loaded, as many little pre-loaders might look a bit silly. How is this done - code please i'm struggling here!!!!!!! Its just when my content loads up at the moment, 1 image pops up and then a bit of text at the top etc and it looks pretty rubbish - i want it all to be pre-loaded and then load up all at once.

QUESTION 2: i have managed to create a motion tween for the images (which are loaded using the following code within a loop:
n.htmlText += imageHolder_home.loadMovie (this["Image"+e]);

now i wish to create a motion tween for the text content too, at the moment its just displayed as dynamic text using the following code in the same loop as above:

n.htmlText += this["Content"+e];

ive tried converting the dynamic text field to movie symbols, and using the same syntax as for the images i.e.:

n.htmlText += contentHolder_home.loadMovie (this["Content"+e]);

but it just wont work? Is it possible to use my text from the DB in a motion tween? How is it done?!?

this is the full code incase you dont understand my description above:

//function to load external data using the loadVars() object
//l=name of loadVars object
//n=name of text field
//t=trigger to decide whether to show all entries or just one.
//e= entry number to display (number)
//f=file to load from (string)
function home(l, n, t, e, f) {
//create a new loadVars object if one doesn't already exist if it does, use it
if (l == undefined) {
l = new LoadVars();
l.onLoad = function() {
var i;
//clear out any text that might already be there
n.htmlText = "";
if (t == content_home1) {
n.htmlText += this["Content"+e];
} if (t == content_home2){
n.htmlText += this["Content2"+e];
}
if (t == content_home3){
n.htmlText += this["Content3"+e];
}
if (t == imageHolder_home1){
n.htmlText += imageHolder_home1.loadMovie (this["Image"+e]);
}
if (t == imageHolder_home2){
n.htmlText += imageHolder_home2.loadMovie (this["Image2"+e]);
}
if (t == imageHolder_home3){
n.htmlText += imageHolder_home3.loadMovie (this["Image3"+e]);
}
}
};
l.load(f);
}
gotoAndPlay(3);


//calls the lv function to display content
//this allows us to take different parts of the info from the DB and place it where we want
//we can even call from different php files
//for the content entry textfield
home(content_lv, content_home1, content_home1, 0, "Home.php");
//for the content2 textfield
home(content2_lv, content_home2, content_home2, 0, "Home.php");
//for the content3 textfield
home(content3_lv, content_home3, content_home3, 0, "Home.php");
//for the image holder
home(imageholder1_lv, imageHolder_home1, imageHolder_home1, 0, "Home.php");
//for the image2 holder
home(imageholder2_lv, imageHolder_home2, imageHolder_home2, 0, "Home.php");
//for the image3 holder
home(imageholder3_lv, imageHolder_home3, imageHolder_home3, 0, "Home.php");


PS would there be a simplify this funtion? i have to create 2 new lots of code when i wish to display just one item from the DB whether its text or an image:

one lot of text in the loop:

if (t == imageHolder_home3){
n.htmlText += imageHolder_home3.loadMovie (this["Image3"+e]);
}


and another to call the function for that particluar text field or image placeholder:

home(imageholder3_lv, imageHolder_home3, imageHolder_home3, 0, "Home.php");

it just seems very long-winded or is does this look ok to you guys? i dont know im a beginner :-(

PROBLEM 3: Another problem is with the imageHolder_home3.loadMovie image holders ive been using - in my flash editor i've just used a plain rectangle and converted it to a symbol with a top-left registration point. The thing is, they dont represent the real width and height dimensions of the actual image - if i set the imageholder to the real dimensions my picture is distorted when its displayed?? Its weird. It seems to take a hell of a lot of faffing around to get my images located where i want them to be, and its the same with the text too. Is there a secret to getting this right? If i could 'see' the images in the actual Flash editor i could create the correct size text fields and imageholders around them, but i cant so im kind of guessing at the moment and its taking ages to get it correct.


PROBLEM 4 - is it possible to create hyperlinks on single words dragged out of the database - my content is stored in a longtext field and so i dont think this can be done, can it?

PROBLEM 5 - once i have loaded an image to the loadMovie object, i tried to add the follwoing actionscript to it, but it does not work:

onClipEvent (mouseUp) {
gotoAndPlay(85);
}

i changed the symbol to a button and added this code:

on(release){
gotoAndPlay(85);
}

now, the image does NOT display but the code works.

How can i get this to work????


so many questions but i bet you guys can help

thanks in advance to anyone who helps me out

Johnny (newbie!!!!)

just ask if you need the flash file and ill attach it :-)

Actionscript Newbie Question
Hi all,

I have been building myself a new website in Flash which contains a number of moving elements.

My last site also used moving elements, but I used the tweening functions of Flash to control their movement.

My new site is a little more complex, and I would like to try to move the elements with actionscript.

Here's how it goes...

I have a button and four movieclip objects on the page. When you press the button, the objects will move to a new coordinate on the page.

It's as simple as that. Ideally, I would like the movements to be smooth and with some acceleration / friction effects involved.

I have been trying to do something with onRelease and moveto commands, but I'm new to this and its baffling me.

Any help would be much appreciated!

Jamlip

Actionscript Question From Newbie
Hey all, I would like to achieve the type of effects found in the banner of this website www.hillsong.com. I am talking about the white vertical line that move from side to side behind the text. Any info on how this can be achieved will be appreciated

PHP Actionscript Newbie Needz Help..
Hi All,

Can anyone help!

I want to create a simple application that allows teachers at my school to:
1- search for a 'username' in MySQL & display then display both the username & department,
2- create a new 'username' in MySQL

I want to use AMFPHP1.9 because then I will not need to write Method Tables, & I am also using FLEX2 builder.
I have very a litle experience with Flex2; AMFPHP(although I have Alessandro Crugnola's HelloWord working)... & not much more experience with PHP; MySQL... So I need lots of help :-)

I have been reading lots of articlles/tutorials regarding amfphp, methode tables php, classes, functions, actionscript2&3 etc, and I understand the big picture. But I think I have confused my self with too much reading.
So if any of you kind people can help me with the php script i need and any actionscript i need in the sections below I would be eternally gratefull.


TIA
Daniel




################################################## ## database stuff ################################################## ##

-- phpMyAdmin SQL Dump
-- version 2.9.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 17, 2007 at 01:35 AM
-- Server version: 4.1.20
-- PHP Version: 4.3.9
--
-- Database: `db1`
--

-- --------------------------------------------------------

--
-- Table structure for table `userdepartment`
--

CREATE TABLE `userdepartment` (
`id` int(11) NOT NULL auto_increment,
`username` text NOT NULL,
`department` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `userdepartment`
--

INSERT INTO `userdepartment` (`id`, `username`, `department`) VALUES
(1, 'john smith', 'geography');


################################################## ## PHP stuff ################################################## ##


##### THIS IS MY dbconnect.php FILE #####
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'db1';
mysql_select_db($dbname);
?>





##### THIS IS MY query.php FILE #####
<?php

/*In this script I want to be able to:
1-
search for the username that is entered in the Search flash application page (Search.mxml)
<mx:TextInput x="222" y="71" borderColor="#000000" id="search_username"/>
& then display the username and their department if it exists in the database.

2-
insert a new username & department from the CreateNewUser flash application page (CreateNewUser.mxml)
<mx:TextInput x="369.5" y="75" borderColor="#000000" id="Create_Username"/>
<mx:TextInput x="369.5" y="135" borderColor="#000000" id="Create_Department"/>
*/

include 'dbconnect.php';

$query = "SELECT $search_username FROM userdepartment";

/*THE $search_username VARIABLE IS WHAT THE USER ENTERS IN THE TextInputBox OF THE search.mxml FILE. HOW DO I PASS THE FLASH VARIABLE FROM Search.mxml TO THE PHP $search_username VARIABLE? */


$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "UserName :{$row['username']} <br>" .
"Department : {$row['deparment']} <br>" .
}

/*I KNOW THAT I NEED TO PUT SOMETHING TO INSERT A NEW USERNAME & DEPARTMENT WHEN A USER CLICKS THE CREATE BUTTON ON THE CreateNewUser.mxml BUT I DO NOT KNOW HOW TO PASS FLASH VARIABLES (CreateNewUsername, Create_Department) TO PHP VARIABLES */

include 'closedb.php';
?>

################################################## Flash stuff ##################################################
In the following two files I have only created the layout in Flex2 Builder because I do not know enough about ActionScript.


##### THIS IS MY Search.mxml FILE #####
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel layout="absolute" height="600" y="19" width="800" x="8">
<mx:TextInput x="222" y="71" borderColor="#000000" id="search_username"/>
<mx:Label x="409" y="73" text="Enter Name To Search For"/>
<mx:Button x="222" y="101" label="Search" borderColor="#000000"/>
<mx:DataGrid x="222" y="181" width="336" height="237">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="col1"/>
<mx:DataGridColumn headerText="Department" dataField="col2"/>
</mx:columns>
</mx:DataGrid>
</mx:Panel>

</mx:Application>


##### THIS IS MY CreateNewUser.mxml FILE #####
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Panel layout="absolute" width="800" x="8" height="600" y="19">
<mx:TextInput x="369.5" y="75" borderColor="#000000" id="Create_Username"/>
<mx:Label x="250.5" y="77" text="Enter Name"/>
<mx:Button x="357" y="209" label="Submit" borderColor="#000000" id="Submit_Button"/>
<mx:Label x="250.5" y="137" text="Department"/>
<mx:TextInput x="369.5" y="135" borderColor="#000000" id="Create_Department"/>
</mx:Panel>

</mx:Application>

################################################## ## End ################################################## ##

Flash 8 Newbie Needs Actionscript Help....i Think
Hi all,

I'm putting together a presentation that has got a scrolling text box with the text loaded from an external .txt file in the root file (it is locally stored not online).

How do i set a button to change the content to a different .txt. file? Also, can i use the button to change not only the .txt file it uses but change the image that is by it too, and if so, how?

Thanks in advance for any help!

Bear

Actionscript Newbie Question
I've been reading the actionscript dictionary and uh...

What is a "string"?
And what is an "expression"?

And can I convert a string to an expression or vice versa?

If so, how?

Newbie Needs Button Actionscript Help
Ok i'm compleatly new to using action script and at the moment i'm trying to create an image gallery for a website that i must have done tonight. I have a constantly scrolling bar of images at the top of my screen that is mouse controlled to stop or change directions depending on the users mouse movements. Each image is a button, i've been trying to figure out how to get the buttons to load the larger version of the images, however when i place said images into the file themsleves even with a stop action, they do not stop and continue to play, as well when i try to get the images to come up when pressing the buttons only they do not come up or open. Would someone plz help me with this issue as soon as they possibly could? I would appreciate the help.

Newbie To ActionScript Oop Xml Question
Hi, I’m new to oop in ActionScript so bare with me when i reply.
I am making a site where the content is coming from an XML file.
Each page (say 5-10 frames in the scene timeline) needs to connect to the XML document and format using its style sheet. It then needs to display the correct node contents in its corresponding text box's.

I have done this for the first page but I now need it to work for the other pages. I don’t want to keep duplicating the code and so I thought oop might help. (I'm pretty interested in learning more about it)

Firstly is this possible? and secondly how?

Basically what i need is a class that connects and parse's the data in the XML file. I then need it to format the data using the style sheet.

Each instance of the class (each page) will connect the correct child node sibling for that page.
I would really appreciate it if someone could let me know if this is possible and maybe post an example.

I Am A Newbie In Coding ActionScript
Hi,

I am creating a simple ActionScript form in Flash 8. I create few TextArea components, I have userInfo.as file, which has getters and setters.

My AS code on Frame 1 looks like:
import users.*;

function fillform(){
uFirstName.text = new users.getFirstName();


trace(uFirstName.text);
if(uFirstName !=null){
trace("Thanks for giving us your information. We'll send you your subscribed magazine in 6 - 7 business days");
}

}

How would you output the inserted First Name? Please help me out, this is an honest request.

Thanks! Suz_1234
stop();

Newbie ActionScript Question
I have one piston made in a 3d program which I just want to
go up and down like a piston, so far I have it going up
inside of a 400 by 600 Flash screen.
I want this to loop going up almost to the top
of the screen then coming down and
stopping close to the bottom.
I will have four pistons on the page which, hopefully
will function like pistons in a engine .

So far I have this,(below)
I am thinking I might need a "stop"
command? I am new to Action Scripting & trying to learn:



pistOn._y = pistOn._y-30;
pistOn._y = pistOn._y;

if(pistOn._y == 25){
pistOn._y = pistOn._y-30;
}

//now to go back up
else if(pistOn._y==25){
pistOn._y = pistOn._y+30;
}
*******************************
I am sure this is not correct
what I plan to do is put four pistons
side by side, placed and
moving like what you would see in a engine.

Maybe add a few other things later,
but now I am just trying to get this up and down plus
the loop.

here is the Flash file so far:

http://www.kevsblues.com/ptn.fla



Thanks

Kevin

http://www.myspace.com/kevinmichaelduggan

Actionscript/Flash 8 Newbie
Hello, I really have no clue where to place this sorry but I was wondering where are there any guides to actionscript 2.0 and guides on using flash 8. The reason I ask this, is because I have never use it before but yet I am suppose to work with someone on a flash project on a game with them and I have no clue what I am doing.

Also any guides to creating xml files? Cuz those are like document files right? where you write stuff? anyways yeah i need help... sorry again

Newbie Actionscript Question
anyone know is it possible to use actionscript writes the following algorithm

step 1:
word = ' ';

step 2:
while not end_of_file
x=read_next_character;
if word + x is in the dictionary // + means concatenate
word=word + x
else
output the dictionary index for word;
add word + x to the dictionary;
word = x;

step 3:
// now end_of_file is true
output the dictionary number for word;


The dictionary contains 256 entries (eg ASCII codes) of single character initially.

An example of dictionary
***************************************

(index) |1|2|3|4|5|6|................ |256|
===========================
(symbols) |A|B|C|D|E|F| ................| 9 |

***************************************

if actionscript can be used to write this algorithm, what is the syntax of getting ASCII? How to translate the algorithm to actionscript?

Actionscript Help Needed For Newbie
hi all, i am good with flash, but not with actionscript, so i have an image at the minute, on frame 1, then the start of the split-up it does on frame 2.

i want to make it so that when you click on the image, it loads frame 2 and continures what i want it to do

on frame one i currently have this :

stop();
on (release) {
gotoAndPlay (2);
}

but it finds an error in the release segment, can anybody please help me?

Newbie To Actionscript Question
HI all,

I use MX 2004 and I am trying to get into actionscript. I have the MX actionscript Bible but I believe this is using an outdated version of actionscript. Is the book still useful to me or do I throw it in the bin?

cheers
George.

ActionScript Newbie: Learn AS2 Or AS3?
I'm wanting to get into Flash development, and I'm trying to work out which language to learn. Do I take this opportunity to skip straight to the newer ActionScript 3? Or do I learn the "simpler" AS2, and migrate once I've mastered it?

I'm hoping to use my development skills mainly for animation (not fully blown Flex apps).

Any help appreciated. Thanks very much.

Actionscript 3.0 Newbie Question
Hi everyone,

I just started to learn AS 3.0. I was ok with 2.0 but now I read a lot of things out there that encourage people to make THE move! I am one of those… but I’m a newbie… so, I have a question: I just read a 2.0 book that said that Top-Level classes are classes that you can use without the need to create an instance. Examples of this type of class include the Math, Mouse, and Key classes. When you think about it, top-level classes make sense. Is there ever really a need to have more than one instance of the Mouse class or the Math class? With the Math class, you simply pass a number into a method, and a result is returned. So why in 3.0, when I use the flyout menu in the action panel, the first choice is «Top-Level» and I see Array and String out there? It doesn’t make sense to me because when you create an Array or String using this syntax — var myArray:Array = new Array(); — you create an instance of the Array class… Can someone explain that to me why they sort the new action panel’s flyout like it is in Flash CS3?

Thanks a lot for your help!

---
Martin
http://www.martinc.biz

Micrphone Help. Actionscript Newbie
Hello, I was just wondering if anyone can point me into the right direction. For my fmp, I am trying to create a voice activated animation. I've been trying a few things out and so far I have a workable bit of actionscipt. The problem is I don't know where to go form here, what to google or even search for. I'm trying to find some way of;

- Finding out the value when spoken. I've seen this done that when someone speaks it gives you a number that is the value of that particular level of the volume spoke, does that make sense?
- To activate a particular movie clip when that value is reached. (so say when the user's voice hits 70 it starts the animation)
- To set other movie clips to fade in & out when their selected value is surpassed. So say you talk which is worth 30, when you talk louder to say 40, then the 30 animation would fade out while the 40 animation would fade in.

Sorry if this really doesn't make much sense, I'm not very good when it comes to explaining what I need. Also if anyone knows any good tutorials for AS, then I would be very grateful. Cheers.







Attach Code

m = Microphone.get();
attachAudio(m);
m.setUseEchoSuppression(false);
s = new Sound(this);
s.setVolume(0);
m = Microphone.get();
attachAudio(m);
onEnterFrame = function () {

circle._xscale = circle._yscale = m.activityLevel+0;
this._alpha = 40;

yell._xscale = yell._yscale = m.activityLevel+0;
this._alpha = 90;

green._xscale = green._yscale = m.activityLevel+0;
this._alpha = 100;

red._xscale = red._yscale = m.activityLevel+0;
this._alpha = 60;

p1._xscale = p1._yscale = m.activityLevel
this._alpha = 40;

};

onFrame

























Edited: 04/09/2008 at 04:37:20 PM by Stevo_Kenevo

Newbie Actionscript Question
I am checking the value of a variable I have just loaded from a php file.
I copy this value to a dynamic text box named checkLog (just for debugging purposes).
The value of checkLog is indeed 1, but the condition
if(this.checkLog == 1)
fails.

I used sendAndLoad to get the value of checkLog from the php file.

Any ideas?
Am I doing an incorrect comparison?

Copyright © 2005-08 www.BigResource.com, All rights reserved