A Question Involving Classes.
Uh, pretty simple question. I create an instance of a class I wrote (MX 2004 Pro) using the ol syntax- foo = new Bar();
Then I wrote the Bar class. And the Bar class does alot of stuff (which I won't get into) but when it's completed, I want the foo object I created to be deleted. So the question is...
Is it possible to reference the instance of the class, within the class definition? So that I can acheive the same effect as writing "delete foo;" inside the code of the class?
You might be thinking, why would I want this. And the answer to that is very complicated. It's for a flash game and it'd take forever to explain. Just rest assured that I'm not crazy, and I am indeed desperatly hoping somebody has an answer for me.
FlashKit > Flash Help > Flash MX
Posted on: 02-13-2004, 02:59 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Problem Involving Gravity
OK first of all, this forum should contain a file upload feature so that we alls can upload our .fla files for you alls to download and view them code, dont you'lls agree?
Anyway, my problem here is regarding gravity. I've set the actionscript of a ball to react to gravity by increasing the velocity of its Y vector everytime the frame plays, to make it have that 10m/s2 freefall. There are 4 walls in my script, top, right, left and bottom. Everytime the ball hits one of these walls, its vector changes, so it will bounce off at an angle.
The bottom wall was coded a little differently, since bouncing on it actually sucks up some of the rebound energy. So what I did was to get its Y vector decrease by a rate of 0.88. Here's the snippet:
setProperty("/obj",_x,getProperty("/obj",_x)+speedx);
setProperty("/obj",_y,getProperty("/obj",_y)+speedy);
//add gravity
speedy+=0.12;
if(_root.obj.hitTest(_root.bottom)){
speedy=(speedy)*-0.88;}
if(_root.obj.hitTest(_root.top)){speedy=(speedy)*-1;}
if(_root.obj.hitTest(_root.right)){speedx=(speedx) *-1;}
if(_root.obj.hitTest(_root.left)){speedx=(speedx)* -1;}
Since the energy drain bit was programmed as a rate of change, the ball should fall evenly, till comes a halt.
It does fine for the first few bounces. Behaves like the real thing. Then suddenly, it dips and falls flat and comes to an almost complete halt.
I'm starting to wonder what is wrong with it here. Could it be that flash has a problem computing floating point?
Than could be the reason, cos if it cant correctly evaluate
something like 0.0023423423984771812836128761E or something like that, then that would explain.
If/Then Involving Movie Clips
I have a button which on rollover causes a movie clip (instance name: menu) residing on the same timeline to play a rollout animation. When you press another button on "menu," it causes another secondary movie clip (instance name: submenu) to rollout and stop.
So basically on the button rollover I want the "menu" clip roll-out to fully extend and stop if the submenu clip has been activated. If not, then on rollover the button plays a normal roll-out animation anytime the mouse is over it. The roll-in is similar. If submenu is activated and visible on stage then menu should just stick. If submenu is not activated then the roll-in animation for menu should play. NOTE: the 2 nested movie clips are blank on the first frame.
**My question is: How do you phrase the conditional statement so that it works. Nothing I tried works. For example, if I used the property "_visible" for the submenu within an expression, it doesn't work b/c I'm assuming the an empty movie clip is visible whether you see its contents or not. Any suggestions or ways to go about this?
Involving Background Music, What To Do?
Hi there (again) :-)
I've a background song to an intro, how have I to set up the properties, I mean, what kind of sound have I to use and what would be the best?
a) Stream
b) Event
c) Start
d) actionscripted (snd = new Sound(); snd.attachsound(), and so on)
??????????
Thanks for helping!
Yar, Question Involving The Get.exe Script
First I want to apoligise for making my first post one of a request, and for my already poor spelling. However I have a farly urgent and yet simple, I hope, question.
first, I am using Flash MX 04
Using the get .exe script (sorry I forget the exact wording) I can open a web page from Flash. However I can not figure out how to make the new window spawn in front of the Flash window. Any help would result in my extrem gratitude and an insubstantial invisible cookie
~thanks a lot
SexyPanda
Problem Involving Sound
Hey all,
I've got an animation for when the menu of the website I'm designing loads. Basically each button alpha fades in via ActionScript (code is on the MC); six buttons in the MC, one per layer. On each of the six frames where the buttons are, I've attached:
Code:
var player = new Sound();
player.loadSound("sound1.mp3",true);
The problem is that I'm only hearing the sound once, towards the end of the animation sequence, not six times (once per button) like I've intended. Am I doing something wrong? Is it simply that the sound file is a shade too long for the individual animations? Any insight/suggestions appreciated
Thanks!
Problem Involving Different Timelines
Alright, i put a stop(); on frame 1. Ther's a movie clip that plays on frame one, and the movie clip eventually comes to a halt in which you press a button to play the actual movie. I put in this code on the button:
Code:
on(release){
stopAllSounds();
_root.gotoAndStop("playmovie");
}
but nothing happens! The intro music stops, that's about it
Please Help Question Involving Video
I'm trying to make a jeopardy flash game for a major summative project and I've run into a problem. I've made 3 scenes, 1 for an intro screen (just click to play), 1 for that I have a video made up for the different jeopardy categories being shown (panning across), and 1 for the actual game.
The problem I have, is after the video plays, I have tried everything my n00b mind is capable of, but I just can't get it to go to scene 3 after the videos done playing. I can get it to loop, I can go from scene 1 to 3, I can get the video to pause at the end, but I cannot get it to go from scene 2 to 3.
If anyone will walk me through it or even point me in the right direction it would be a huge help.
P.S. How hard would it be to have a dynamic scoreboard, and also have the buttons disappear after theyve been clicked? Thats just bonus though.
Conflict Involving Menubar
In my applet I have a menubar with menus and some buttons...
I have found that before I use the menubar my button works every time I click on it, but after I open the menu (even if I don't select anything) I can't click the button more than once.
If I move the mouse before I click the button again then I the button does what it is supposed to again.
I was just wondering if there was a way to get around having to move the mouse before the button can do its task.
Tell Target Problem Involving Buttons/MC's
OK heres how the problem goes:
I have a button in Scene1 the button has an instance of a movieclip that does a mouse-over affect. but i want that on mouse-out that same movieclip continue playing.
i hope i explained it good enough...
i used the following code but i dont know if its right.
on (rollOut) {
Instance.gotoAndPlay(12);
}
please help me
-Sq
Sounds Effects Involving Scripting
Hi,
I was wondering if anyone knew where I can find interesting methods of utilizing sound in flash movies, with or without ActionScript.I would like to create some games that are sonically based, and include a high level of interactivity.
Thanks, Gabrielle
Toughie Involving Flash And Powerpoint
Okay people this is the situation:
I need to be able to control a powerpoint presentation (jump to different slides) via a Flash movie embedded in it. Can this be done using the VB end of PP or someother method? Or is it simply not possible?
ANY input is greatly appreciated even if you just post to sat 'I don't think t can be done' or whatever.
Thanks everyone
Mark
Action Script Involving Buttons
Hey,
I'm really stuck on this...
I'll post a picture of the movie clip, so you know what i'm talking about.
<IMG SRC="http://members.shaw.ca/ibbanging/timeline.gif">
Here is what i'm trying to do, this is a movie clip I have inserted into a scene. It's controlled by another button, as this movie clip consists of 3 buttons which fade in and fade out, it's controlled by the main button.
Here is the problem; I can't figure out the code to make the whole thing work.
I want it to when ya hit the button once it plays the first part, hence it fades in, and when you press it again, it plays the last part, and fades out.
I can only get it to fade in, and when ya press it again it fades in again.. it won't fade out.
Code:
on (release) {
sub_lore.gotoAndPlay();
}
Thats what I am using, "sub_lore" is the instance name of the movie clip explained above.
Any help is apreciated, thanks.
Ian
Example Of Game Involving Throwing Objects From Above?
I'm attempting to create a game where you throw objects out a window and try to hit other objects below. Does anyone have a source file for such a game I could look through to get an idea of how it was done. I'm planning on doing this in Flash 4. Any help would be appreciated.
A Problem Involving Quicktime With Flashmx
i have a problem,i had to update Quicktime for flashmx.but in the process,all my gifs,pngs and jpegs were put to Quicktime format.they were fireworks and photoshop before,how can i channge this back?i can't edit through fireworks with my flash program.
AS 2.0 Class Question Involving RemoveMovieClip()
Ok I created a class called lazer. This class is registered to my lazerBeam movieclip. Basically the class moves the beam across the screen.
The problem is, when the beam reaches the end of the screen I want to remove it, but saying 'this.removeMovieClip()' does not work from inside the class. It says removeMovieClip is not a method of the class. Is there a way to make it realize I want it to call the removeMovieClip() function of the movieclip class?
I suppose I could extend the lazer class from the movieclip class but I was hoping to extend from something else.
Very Strange Problem Involving This[] Command
Wow, I think this one has me whipped.
Check the difference in the code and the difference in the output.
In this example the variable "IndID" is already declared = 1.
Code:
on (release) {
combatantFound = 0;
//IndID++;
trace(IndID);
trace(this["combat"+IndID]);
if (this["combat"+IndID].text.length == 0) {
trace("true");
}
}
the output for this is:
Code:
1
_level0.combat1
true
No problem. But if I want to evaluate any other variable other than 1 it screws up. Notice this code is almost exactly the same except line # 3 is not //'ed out.
Code:
on (release) {
combatantFound = 0;
IndID++;
trace(IndID);
trace(this["combat"+IndID]);
if (this["combat"+IndID].text.length == 0) {
trace("true");
}
}
and the output for this is:
Code:
2
undefined
WHAT ON EARTH?!?!?!?!?!?
this is driving me freaking crazy.
please help.
[F8] Queastion For The Gurus Involving Web Content?
I am building a website and I thought it would be really cool to be able to make a page that I could login to (straight from my flashsite) that would act as a text editor for my updates section. (hope that makes sence) basicly I was thinking using input boxes say one that says DATE: , SUBJECT: and TOPIC: and I would be able to type in to those boxes and click a submit button and it would then update a text/html file that I would dymically load into my flash site. (sounds quite complicated). my problem is I am really quite a newb when it comes to flash so I was wondering if anyone could lend some advice/ tutorials to help me get started. Cos i think it would be really neat to be able to use something like that in a website.
cheers
[F8] Question Involving GetHours() And Testing.
i am developing a site that will change appearance based on the time of day using the code below:
Code:
my_time = new Date();
identifier=my_time.getHours(); //gives U an integer 0-23
if(identifier<7||identifier>21) {
//here is the nitetime part
} else {
//here is the daytime part
}
I have 2 questions.
1. is there a better way i can test this site without having to change the time on my computers clock for each section?
2. do you feel this code is the best approach to obtaining this goal?
i appreciate your help
A (different) XML Question Involving Modifing The XML Objects Value
I posted in another thread how to save XML, and I decided to use php (for I already know php). Currently have an XML document in this layout
Code:
<users>
<user>
<name></name>
<pass></pass>
etc, etc
</user>
</users>
I want to beable to modify a particular <user>'s nodes, without affecting the others. This is for my Profile page that allows you to set your options. I wish to do this so I can just pass the whole XML data to the php page, than write it,
Also, will this php code work (from memory, so just the general concept)?
PHP Code:
<?php
$fp = fopen("user.xml", "w+");
fwrite($fp, $data);
fclose($fp);
?>
How would I access the variable from flash? $__POST[???]?
Hi-res Export Of Images Involving ActionScript
Dear Flash Forum members--
I am using Flash 8 to generate figures for a scientific publication. I've written code in ActionScript that processes my data and creates a plot upon running the .swf file. I'd like to save this image at high-resolution. Thus far, I have used screen capturing or printing to a pdf, but neither of these has sufficiently high quality (i.e., 1200 dpi). I can't just use the image export commands within Flash b/c the ActionScript doesn't execute.
Do you have any suggestions for what I can do? Does CS3 somehow enable the export of high-res images where ActionScript has executed?
Thanks very much in advance for considering my question.
If Statements Involving Speed + Coordinates
Hey Everyone!
So i'm fairly new at Flash and am having trouble writing a certain if statement. Kirupa has this cool sliding menu thats all in one document, with all the different backgrounds on a single timeline. What I want to do is when one of those menu's appears in the center of the screen completely still to load an external .swf. The only idea I had is to write an if statement stating:
If the background_mc is == to a speed of zero + coordinates of x = 0, y = 0 then perform this action. Anyone know how to write that?
If Statements Involving Speed + Coordinates?
Hey Everyone!
So i'm fairly new at Flash and am having trouble writing a certain if statement. Kirupa has this cool sliding menu thats all in one document, with all the different backgrounds on a single timeline. What I want to do is when one of those menu's appears in the center of the screen completely still to load an external .swf. The only idea I had is to write an if statement stating:
If the background_mc is == to a speed of zero + coordinates of x = 0, y = 0 then perform this action. Anyone know how to write that? And also if there's a better way to do this let me know thanks!
Weird Bug Involving Graphics.beginBitmapFill()
I've been fooling around with bitmaps lately, and I've come across an odd issue:
I have a BitmapData object, which is drawn in two Shape objects onstage using graphics.beginBitmapFill() and graphics.endFill(). These two Shape objects appear and disappear at different times, in different order. Sometimes, one of the Shapes will fail to draw the bitmap fill. When this happens, this Shape is always the second Shape to show up onscreen. However, if I tell it to draw a clone of the BitmapData object rather than the BitmapData object itself, or if I tell it to use another BitmapData object and copy pixels from the original to the new one, the bitmap fill succeeds.
What I'm inferring is, the beginBitmapFill() function seems to fail in this certain situation, where the same Bitmap data is being drawn more than once in a relatively short period of time.
I suspect that this has something to do with endFill(). The AS3 language reference states that a bitmap fill isn't drawn to the screen before the endFill() method is called, and even though I am calling it, I think that this strange endFill() dependency may be causing the problem.
Has anyone else experienced a similar problem with a bitmap fill failing to draw to the screen?
Advice Needed Involving Charts
I have a form that takes two pieces of input from a drop-down menu. Once, the user clicks the submit button, I want my barchart to adjust based on a set of fixed values that coincide with the selections made by the user. My question is, should I be creating a separate animation of my barchart for each combination that the user selects from the drop down menu? Here is an example I found that is kind of what I was aiming towards (the first example "BarChart") http://www.flashloaded.com/flashcomponents/flashcharts/
So, what I am thinking is that my actionscript should open the .swf file that contains the barchart that needs to displayed based on what the user inputs. Which means since I have 35 possible combinations then I need to build 35 .swf files that will play if it is selected?
Thanks,
Laura
3 Major Questions Involving As Movement On(keypress)
I have problems involving a as movement that is operated by keypress.All the code is at the bottom of the page.The set up is this.
the movie has an invisible boundry that the script below activates. the movement is of a car. when the car goes past the boundry it will continue going if the user keeps the key pressed, but the on release the car reverses back to inside the boundry.
Question 1
How do i get the mc to slow to a virtual stop past the boundry line if the user still key the key pressed, and then on release of the key it reverses for a bit at a lower velocity?
You follow?
Question 2
How do i add a good rotate function? As you can see from the code given below I have tried to add one with a little success, but this code goes wrong when the _rotation value of the mc goes above 180 and below -180 (it automaticaly continues to spin. The rotate function works on keypress of left and right. The other problem associated with this is that i want to be able to adjust the left/right motion at the same time as the rotation. ie, a car, as it turns left or right it also moves forward in the direction of the _rotate value?
Question 3
When i press up how do i get it to move forward in the direction of the rotate value?
here is all the code
Code:
on the frame....
// rotation function
function rotation (theClip) {
hereRotate = theClip._rotation;
differenceRotate = rotate-hereRotate;
// rotation factor
if (Math.abs(differenceRotate)<.1) {
theClip._rotation = rotate;
} else {
moveRotate = differenceRotate/10;
theClip._rotation = hereRotate+moveRotate;
}
}
// y function
function moveMey (theClip) {
herey = theClip._y;
differencey = targety-herey;
// movement on y
if (Math.abs(differencey)<.1) {
theClip._y = targety;
} else {
movey = differencey/10;
theClip._y = herey+movey;
}
}
// x function
function moveMex (theClip) {
herex = theClip._x;
differencex = targetx-herex;
// movement on x
if (Math.abs(differencex)<.1) {
theClip._x = targetx;
} else {
movex = differencex/10;
theClip._x = herex+movex;
}
}
on the button (invisible)
// Buttons
on (keyPress "<Left>") {
_root.targetx -= 5;
_root.rotate -= 5;
}
on (keyPress "<Right>") {
_root.targetx += 5;
_root.rotate += 5;
}
on (keyPress "<Up>") {
_root.targety -= 5;
}
on (keyPress "<Down>") {
_root.targety += 5;
}
on the mc
onClipEvent (load) {
_root.rotate = this._rotation;
_root.targety = this._y;
_root.targetx = this._x;
}
onClipEvent (enterFrame) {
_root.rotation(this);
_root.moveMey(this);
// add an if clause so the animation loops back
if (_y>275) {
_root.targety -= 2;
} else if (_y<25) {
_root.targety += 2;
}
// add an if clause so the animation loops back
if (_x>275) {
_root.targetx -= 2;
} else if (_x<25) {
_root.targetx += 2;
}
if (_rotation>180) {
_root.rotate = 0;
}
}
I know this a lot to ask, if you can't handle answering all the questions, perhaps you could manage just one......please. pretty, pretty please (battering eyelids at you)
Minor Disaster Involving Font Outlines
hi—
my hard drive crashed over the weekend and i had to reinstall system software.
in a couple of movies i was using a postscript typeface by jonathan hoefler (knockout), which flash now refuses to recognize—the type looks sh***y in both the .fla and the published .swf.
could the implosion of my hard drive and subsequent reinstallation of system software wreak havoc with my fonts?
any advice?
Weird Behavior Involving Scaling And Pixellation
Hi, I have a pretty wierd problem.
I have a flash movie with only 1 frame. On the stage is a movieclip which is just a picture of something. On that movieclip I have the following code:
onClipEvent(load) {
this._xscale = 3000;
this._yscale = 3000;
}
So basically it just makes the image really huge. When I hit test it shows me a really really close up picture (but very smooth), which is what I expect.
Now... I go to frame 2 and hit F5 (insert frame). The same movieclip with the same actionscript code is now in 2 frames instead of 1.
Now I hit test and it shows me the same image except now it is WAY pixellated! I don't understand why the difference between how many frames my movie has affects how pixellated the blown up image looks.
Any help?
Thanks,
JLo.
Conflict Involving Clock And Date With Scene
Hello...first of all thanks for your time to help.
I have a scene that has a clock and date at the top. Within the clock and date, they both have the GoToandPlay (1) in order for them to work.
Well I want to have other things animate such as text fading up, but cant because those frames say go back to frame 1.
Can you help?? Anything is apprectiated! Thank you!!
Simple Flash Involving Zooming An Image
I've not yet used flash but am wanting to use it to make an enhanced visual guide for some images on my site.
I have standard sized images that are all 725x460. I'd like to have an enhanced guide that will launch flash and allow me to make that 725x460 image zoomable. To see an example of my interface go and click on any link here:
http://www.jeditemplearchives.com/otc/
Each image is 725x460. These are all resized images. My original images are much higher resolution. I would like to make an enhanced version that allows the viewer to open a similar flash interface that starts out at 725x460, but allows them to zoom in on the image to increase detail.
Thanks for any help! I'm a total newbie and have yet to make anything in flash, so any help is appreciated!
[CS3] A Question Involving The Tween And Transition Class.
I have a document that has thumbnail images that when you click on them a larger version of that image loads in above it. My question is if you can use the transition class to use random different transitions when loading in the different larger images. So, basically when you clicked on one of the small images the photo of the larger version would do something like fade in and then if you clicked on another image it would do something like wipe in. I'm just curious if you are capable of doing this in actionscript so it would just randomly chose a transition to apply to the images. Thank you so much!
Just Starting Out, Simple Question Involving Buttons?
I have done a tutorial to create a vertical scrolling menu. It has setup variables for each button the code is as follows:
// ti=total menu items
// dup=new movie duplicates
// butn=original movie button
butn:text = /:item0;
while (Number(n)<Number((..:ti*2)-1)) {
n = Number(n)+1;
dup = "butn" add n;
duplicateMovieClip("butn", dup, n);
setProperty(dup, _y, Number(getProperty(dup, _y))+Number(n*getProperty(dup, _height)));
set(dup add ":n", n);
if (Number(n)<Number(..:ti)) {
set(dup add ":text", eval("..:Item" add n));
} else {
set(dup add ":text", eval("..:Item" add (n-..:ti)));
}
}
This is the code that it said to put on the button:
on (press) {
/:text = ..:text;
}
on (rollOut) {
/:text = "";
}
on (release) {
// DO SOMETHING
I have no clue what it does?
I am new to this but I am assuming i am using one button to create mutiple. This is working ok but I am not sure how to create the code on the press of the button so that it will get a url or load a clip. My goal would be that if I am clicking button2 then it will call url button2.html same with button3,4,5,6 and so on. I know this is very newbish but if someone could point me in the direction of some tutorials or help I would be vary greatful.
Question Involving Looping Movie Clips
The stage area is 300x200. I have a ball that moves around with the arrow keys. However, if the ball goes all the way to the right of the screen, i want it to appear on the left side, and if the ball goes on the left side i want it to appear on the right side. So i assigned the code to the ball:
Code:
onClipEvent(enterFrame){
if(Key.isDown(38)){
_root.ball2._y = _root.ball2._y - 5;
}
if(Key.isDown(40)){
_root.ball2._y = _root.ball2._y + 5;
}
if(Key.isDown(37)){
_root.ball2.gotoAndStop("left");
_root.ball2._x = _root.ball2._x - 5;
}
if(Key.isDown(39)){
_root.ball2.gotoAndStop("right");
_root.ball2._x = _root.ball2._x + 5;
}
if(this._x>300) {
//<=
this._x = this._x - 300; //<=
}
if(this._x<300){
this._x = this._x + 300;
}
}
However, it doesn't work. I've been experimenting with this for several hours now and i still can't figure it out
A Question Involving Actionscript, Vbscript And SQL Database
Hi All,
I hope I reached the right place for help.
I'm currently developing a game which utilize flash as the graphics and SQL database for the data storage.
My initial plan was creating a flash (swf) and paste it on the application created by VB.net that takes the data from SQL database.
I couldn't locate the code to transfer the data from VB.net to the flash's actionscript. (If anyone has any idea on this would be great too) So now I hope I can fully utilized Actionscript.
I have stumbled upon some website that told me that I can write VBScript into Actionscript of the flash.
Can I do that?
Second, if I cannot use that, can flash retrieve data from SQL database and what is the coding to do this?
Third, I am not very good at Actionscript, so I want to ask Can I use functions and subs like in VB in Actionscript as well?
Thank you in advance.
How To Render Images Without Involving The Webserver Filesystem?
I am new to Flash 8 and AS 2.0, so bare with me ...
Is there any way to display/render ordinary image types (.gif, .jpg, ...) in AS 2.0 without relying on the server's filesystem?
I have my image data stored binary in a database (ms sql server 2005).
The binary image data is then transfered (encoded in base64) over xml from my server side (asp.net 2.0) to my Flash 8 client component (.swf file).
Upon arrival in the client (Flash .swf file) the binary image data is decoded and kept in String variable in Flash 8.
These steps seem to work fine although I would have prefered Flash 8 to expose a "true" Byte datatype instead of using a String datatype.
But how do I go about from here to successfully render the final image in Flash 8?
Thus, what I am trying to do is to use the memory as a "url path" for my image data and not referencing some image file through a "url filesystem path".
Can this be done in Flash 8?
I have looked at the (new) BitmapData API in flash 8 but it seems as even this API relies on some sort of filesystem involvment in the exposed method arguments...
I am creating a website with an "extra" administration gui where the admin account will not have write access on the webserver's filesystem,
hence I am storing the images in a database and trying to render images dynamically "from memory" ...
Does anyone have any tips or ideas how to approach this problem?
Regards,
Carl
Problem Involving The Liquify Effect Tutorial...
I got the effect to work perfectly from the root timeline, however, I need the effect underneath some objects on the same timeline. How should the code change in order for the effect to be placed inside of a movieclip?
Another Question Involving Preloaders And Multiple Swfs
Hey guys,
I did some Flash work for my company here about a month ago. Some guys from a company upstairs helped us out with some graphics, and now we are returning the favor to them by helping them with their new website. Unfortunately my work didn't quite get to the level that they are looking for so I was hoping some of you could give me a kick in the right direction. Basically the site has a whole bunch of .swf files. For the main page there is a background with a few buttons at the top and a spinning graphic as the first swf , as well as a movieclip that plays a small video on the page as a second swf and finally some navigation with 4 buttons as a 3rd swf. Also, all the 'subsites' are .swfs as well... this is what they are asking...
They want a single preloader for the main page, that is, preload the 3 .swfs i mentionned with a single preloader 'image'. They then want, once the main page is loaded, for the 'subsites' to begin preloading in the background (which I think this: http://proto.layer51.com/d.aspx?f=741 should work fine for).
So if anyone can help me with the first part and maybe tell me "that will or will not work" for the second it would be a great help.
Thanks a ton,
--D
Small Problem Involving SetProperty And Image Panning
I've been working on a simulated VR presentation for a client, and I adapted some code that pans a panoramic image left and right. The thing is that I've also integrated zoom functionality that causes my image to scale, and I needed to add the ability to pan up and down once the image was scaled up over 100%, so I added this to my drag function. Here is the code in question:
Code:
tellTarget ("../") {
trace(cur_x1);
cur_x1 = getProperty("/movie1", _x);
cur_x2 = getProperty("/movie2", _x);
cur_y1 = getProperty("/movie1",_y);
cur_y2 = getProperty("/movie2",_y);
if (Number(cur_x1)<Number(-1400)) {
setProperty("movie1", _x, Number(cur_x2)+1461);
}
if (Number(cur_x2)<Number(-1400)) {
setProperty("movie2", _x, Number(cur_x1)+1461);
}
if (Number(cur_x1)>1400) {
setProperty("movie1", _x, cur_x2-1461);
}
if (Number(cur_x2)>1400) {
setProperty("movie2", _x, cur_x1-1461);
}
if (Number(cur_y1)<Number(-462)) {
setProperty("movie1", _y, Number(cur_y2)+205);
}
if (Number(cur_y2)<Number(-462)) {
setProperty("movie2", _y, Number(cur_y1)+205);
}
if (Number(cur_y2)>462) {
setProperty("movie1", _y, cur_y2-205);
}
if (Number(cur_y1)>462) {
setProperty("movie2", _y, cur_y1-205);
}
}
The problem is that no matter if the image is scaled or not, dragging up and down will push the image past the boundaries I want. Ideally, it should stop panning up or down once the top and bottom edges of the image are reached.
Any assistance would be GREATLY appreciated ... thanks in advance!
Cheers,
Xenon.
PS: the image in question is 1461 * 205 and duplicated in the SWF it's in to make it appear seemless when it is panned left and right.
Two Part Question Involving Colors And MC Variable Passing
Hi everyone,
first let me set the "Stage" if you will...
I have two movie clips on the stage, one of which is called "shoe", and the other is "swatch".
the shoe instance has a shoe in it, each seperate part of the shoe separated into movieclips with their own instance names (tongue, laces, etc).
So when the user clicks on a part of the shoe, the swatch appears (swatch was always there, but it was held on an empty frame until user selected a shoe part).
My goal is for the user to be able to pick different parts of the shoe and change its colors.
So, I created a variable called "shoepart" that gets set to the instance name every time someone clicks a part of the shoe:
code:
shoepart = "swoosh";
The purpose of me doing this is that I intend on passing shoepart to the swatch movieclip, so that it knows which movieclip to affect in "shoe."
However, this will only work if I hardcode the instance name of "swoosh" into the code, as shown below (ignore the if statement for now):
code:
on (release) {
if (shoepart == "swoosh"){
var colorful = new Color("_root.shoe.swoosh");
colorful.setRGB(0xFF3355);
}
else
{
shoepart = "swoosh"}
}
What I would like to do is have it do something like this:
code:
on (release) {
var colorful = new Color("_root.shoe.shoepart");
colorful.setRGB(0xFF3355);
However, since I'm mixing variables into the dot notation, I think AS doesn't really know if it's looking for a variable or an instance name...? Or perhaps I'm using the wrong syntax in the parameters? If I could get this to work, all I would have to do is make sure the variable gets set every time the user clicks on a different part of the shoe so that they can change the color of it.
Also, for part two of my question, I would really like this only to change the FILL color of the movieclip -- as they are now, they are white with black stroke. When I click on the swatch, it changes the stroke and the fill to one color.
thanks for reading this long winded thread!
[F8] Question Involving Playing The Main Timeline In Reverse
Is it possible?
I'm hoping that I can do an "on (release)" command on a button that makes the timeline play in reverse.
Is that a common thing outside of being used on a Movie Clip? If so an example of the actionscript would be SO helpful.
Thanks!
First Post By Me, Very Noob Question About A Script Involving Video
Hi all,
Looks like this community is pretty alive, I am glad I found it. On with the problem.
First things first. I am VERY green when it comes to Flash 8 and programming. I am actually a certified network tech so i am more of a hardware guy.
Now what I need to do is encode a video into flash (that part is done already) and create a custom player for that video. To help me get along I am following a Lynda.com tutorial on exactly that topic.
I am now at the point where I need to type the script. I typed it exactly as it was in the tutorial but when I preview the movie all I get is sound, no image.
here is the code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
video.attachVideo(ns);
ns.play("ccmmdiscours1.flv");
I re-encode the video just in case that was not the problem but the issue is back. That exact code was used in the tutorial and his preview worked.
Any thoughts?
Thanks
Slave1
General Action Script Question(involving Variable Types.
Ok, I got kind of a strange question.
Is it posible to set an variable to an MC using a string?
I want to be able to dynamicaly set a variable to an MC without using some huge if statement.
so like
Code:
var1 = 4;
MC_holder = "MC_" + var1;
so that MC_holder actualy holds the MC MC_4?
I hope I am not too off the deep end here. Any help would be great
A Preloader Question Involving Multiple SWFs With LoadMovie Command
Hello and thanks for any help you can give me,
I need to build a preloader for an interface I've made using lots of levels and about 15 different swf files. My questions:
-Can I get a single preloader to load all of the desired swf files at once?
-Where should i put the preloader in relation to the other files?
The basic structure works like a windows folder for example, and all the movies are basically windows. There is a main.swf on level 0 that loads about 7 different movies (or windows) on level 1, and from each of those movies there are about 10 different movies on level 2. *But* as you close the movies on level 1 and level 2, the main.swf on level 0 needs to reload...but I don't want the preloader to restart every time this happens. How should i fix this?
The entire structure sounds a little clumsy I know, but this is the first time i've put together an interface with this much interaction involved.
Thanks,
JT
Newbieish Question Involving Right-click Menu And Movie Quality
Unfortunately I seem to be unable to find the answer to these anyway, even though they're simple -
What actionscript do you use to change the graphics quality? I'd like to have a button for crappier computers.
How do you disable functions on the right-click menu? I've noticed a few online games have a right click menu with only two options to prevent cheating. I'd like to do this too.
Thanks! Sorry for asking such newbie questions
Custom Classes: One Class Tracks Multiple Other Classes?
I'm working on a coloring that allows kids to place objects on a scene and then color them so the image can be printed out. So assume you have sky background, the child can select a bird object, drag it into place and once they have it in place, color everything on the page (with a given palette of colors.)
So far it going great. However I want to track what objects have been added to the drawing on the fly. I have a potential solution using arrays but I'm thinking this is perfect opportunity to start using custom classes.
I'm thinking that I'd create a new instantiate a copy of the object class each time an object is added to the scene. However to track the objects added to the scene I'm thinking I'll also use an listing class to track them.
What I'm not sure about is the would the listing class simply contain an array of object identifiers? Any thoughts on the structure of the listing class?
I'm very new to oop as I've mainly been doing procedural programming up to this point but I'm eager to give this a shot.
Thanks!
HEADS UP: Flash Glitch Involving Ternary Operator (?:) And Auto Format
I am not sure if its just or if this is a real glitch but man this has caused me so much trouble for the past couple of days till I figured it out.
If you use ternary (example)
PHP Code:
(foo<10) ? [true statement here] : [false statement here];
there is a nasty glitch that happens (to me) when it comes after a ' } '
PHP Code:
for(var i:Number = 0; i<some.length; i++){
// omg i'm incrementing
}
(foo<10) ? [true statement here] : [false statement here];
If you hit the Auto Format button in flash this happens
PHP Code:
for(var i:Number = 0; i<some.length; i++){
// omg i'm incrementing
}
foo<10) ? [true statement here] : [false statement here];
/// DUDE WHERE'S MY LEFT ' ( '
And while this is easy to find if you double click on the error... when you see the 'missing something error' your (my) first instinct isn't to go back 50-100 lines for the problem, but something you just wrote is the issue... -.-
whats the band-aid?
PHP Code:
for(var i:Number = 0; i<some.length; i++){
// omg i'm incrementing
}
// lol I'm not just a comment... I protect my buddy below
(foo<10) ? [true statement here] : [false statement here];
Using Flex Classes In Classes Linked To Symbols
Hi all
I have a fla file where I link a symbol to an action script class. This action script classes references mx.collections.ArrayCollection; so when I attempt to publish the fla file, I get the error message:
1017: The definition of base class ArrayCollection was not found.
I then tried to add a class path (this folder contains the mx... classes):
C:Program FilesAdobeFlex Builder 3sdks3.0.0frameworksprojectsframeworksrc
and the the above error 1017 wasresolved, but now I get the error:
Version.as, line 18 1004: Namespace was not found or is not a compile-time constant.
So now I am pretty much stuck. What do I need to do for this to work ? Please note that the code compiles fine in flex, so it is not som basic coding error ?
|