[Flash 8 ActionScript] Need Advice On Making This Lighter/simpler
Hi... so I'm a designer and an AS novice. I would like to improve upon my coding knowledge/skills in a big way so I'm looking for a critique of the following code. Everything works really well how it is, but I was wondering how to make the code lighter or simpler if possible. Can I use loops or arrays for any of this, are there methods and functions I should consider, etc... So the purpose of the following is to pull in up to 3 movies and recurse through each infinetly or until the user selects one of the tabs or a pause button. On load the first movie loads into the main space and a tab shows up and a progress bar in the tab movie begins to move. When the user clicks the tab the progress bar stops and loads the corresponding movie (the pause button switches to a play button). When play is clicked the progress bar on whatever tab you've selected begins again and the movies once again are switched out. Code: //Using a package called Tweener. Documentation can be found here http://code.google.com/p/tweener/import caurina.transitions.*;movieLength = 7;movieFade = .25;//movie variablesvar main_location, promo_file1, promo_file2, promo_file3, promo_label1, promo_label2, promo_label3, promo_headline1, promo_headline2, promo_headline3, promo_message1, promo_message2, promo_message3, promo_label1;trace(promo_file1);tab1._visible = false;tab2._visible = false;tab3._visible = false;var NumberOfMovies = 0;//promo_label1 = "Save 5";//promo_label2 = "Save 25";//promo_label3 = "Save 250"; //promo_file1 = "MobileSoftware.swf";//promo_file2 = "Spend35get5off.swf";//promo_file3 = "CommunicationsSoftware.swf"; //loads the movies into individual clipsif(promo_file1){var container1:MovieClip = createEmptyMovieClip("container1", getNextHighestDepth());var mcLoader:MovieClipLoader = new MovieClipLoader();mcLoader.addListener(this);mcLoader.loadClip(main_location+promo_file1, container1);NumberOfMovies++;tab1._visible = true;}if (promo_file2){var container2:MovieClip = createEmptyMovieClip("container2", getNextHighestDepth());var mcLoader2:MovieClipLoader = new MovieClipLoader();mcLoader2.addListener(this);mcLoader2.loadClip(main_location+promo_file2, container2);NumberOfMovies++;tab2._alpha = 0;tab2._visible = true;}if (promo_file3){var container3:MovieClip = createEmptyMovieClip("container3", getNextHighestDepth());var mcLoader3:MovieClipLoader = new MovieClipLoader();mcLoader3.addListener(this);mcLoader3.loadClip(main_location+promo_file3, container3);NumberOfMovies++;tab3._visible = true;tab3._alpha = 0;}//plays the moviesif (Math.round(container1.getBytesLoaded()) == Math.round(container1.getBytesTotal())) { if(NumberOfMovies >1){ Tweener.addTween(tab2, {_alpha:100, time:.5, transition:"linear"}); Tweener.addTween(tab3, {_alpha:100, time:.5, delay:.5, transition:"linear"}); playFirst(); }}function playFirst(){container1._visible= true;container1._alpha = 0;container2._visible = false;container2._alpha = 0;container3._visible = false;container3._alpha = 0;_root.tab1.gotoAndStop(1);_root.tab2.gotoAndStop(2);_root.tab3.gotoAndStop(2);Tweener.addTween(container1, {_alpha:100, time:movieFade, transition:"linear"});Tweener.addTween(tab1.progressBar, {_xscale:100, time:movieLength, transition:"linear", onComplete:playSecond});}function playSecond(){Tweener.addTween(container1, {_alpha:0, time:movieFade, transition:"linear"});container1._visible= false;container1._alpha = 0;container2._visible = true;container2._alpha = 0;container3._visible = false;container3._alpha = 0;_root.tab1.gotoAndStop(2);_root.tab2.gotoAndStop(1);Tweener.addTween(container2, {_alpha:100, time:movieFade, transition:"linear"});Tweener.addTween(tab2.progressBar, {_xscale:100, time:movieLength, delay:.25, transition:"linear", onComplete:playThird});}function playThird(){container1._visible= false;container1._alpha = 0;container2._visible = false;container2._alpha = 0;container3._visible = true;container3._alpha = 0;_root.tab2.gotoAndStop(2);_root.tab3.gotoAndStop(1);Tweener.addTween(container3, {_alpha:100, time:movieFade, transition:"linear"});Tweener.addTween(tab3.progressBar, {_xscale:100, time:movieLength, transition:"linear", onComplete:playFirst});}pause2._visible = false;pause1.onPress = function(){ Tweener.pauseAllTweens(); this._visible = false; pause2.gotoAndStop(2); pause2._visible = true;}pause2.onPress = function(){ Tweener.resumeAllTweens(); this._visible = false; pause1._visible = true;}tab1.onPress = function(){Tweener.removeAllTweens(); playFirst(); Tweener.pauseAllTweens(); pause1._visible = false; pause2._visible = true; this.gotoAndStop(1); tab2.gotoAndStop(2); tab3.gotoAndStop(2); container1._visible = true; container1._alpha = 100; container2._visible = false; container2._alpha = 0; container3._visible = false; container3._alpha = 0;};tab2.onPress = function(){Tweener.removeAllTweens(); playSecond(); Tweener.pauseAllTweens(); pause1._visible = false; pause2._visible = true; this.gotoAndStop(1); tab1.gotoAndStop(2); tab3.gotoAndStop(2); container1._visible = false; container1._alpha = 0; container2._visible = true; container2._alpha = 100; container3._visible = false; container3._alpha = 0;};tab3.onPress = function(){Tweener.removeAllTweens(); playThird(); Tweener.pauseAllTweens(); pause1._visible = false; pause2._visible = true; this.gotoAndStop(1); tab1.gotoAndStop(2); tab2.gotoAndStop(2); container1._visible = false; container1._alpha = 0; container2._visible = false; container2._alpha = 0; container3._visible = true; container3._alpha = 100;};//product variables//var product_name1, product_name2, product_price1, product_price2, product_description1, product_description2, product_id1, product_id2, product_rating1, product_rating2, product_image1, product_image2, product_trial1, product_trial2, product_discountCode1, product_discountCode2, product_discount1, product_discount2; Thanks for looking at this,Tucker
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 12-18-2007, 03:54 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Help I Am Making A Fighting Game With Actionscript (MUCH SIMPLER Than It Sounds....)
Hi, Im making a pseudo fighting game. Its actually just a animated showcase of some characters with some pre-set animations against each other.
Im having trouble with the menu system.
Basically, its unbelievably simple.
Menu 1. SElect 1 character out of 5. (will be put on left side of screen)
Menu 2 (same set up as Menu 1 but previously selected character will not be selectable) will be put on right side of screen
Fight screen- has selected Menu1 chracter on left side of screen
and selected Menu2 character on right side of screen.
I know the FLA file looks so cheap and half assed but the animation portion IS very detailed (for abegginer like me)
I was wondering if anyone can tell me what Im doing wrong because its not working or if you can point me in the right direction. thankyou very much!
Making THINGS LIGHTER
hi i'm trying to finalize my website:
http://lint.free.fr/THISISIT.html
the document you view there is three megs of weight, i'm on mac so i didn't find an optimizar to get it lighter. so i tried to get it lighter the right way i guess by slicing my single document into different movies i made three movies used the select unused items to delete the unwanted images and saved these files to my disk. Unlucky me i realised these filez supposed to be smaller are actually the same !!!!!
so how come they dont loose the k's they should ???
HEEEELPPPP !!
i just can't understand that !!
any help would be great
thanx....
Making A Flash Game - Help/Advice
Hi, i took a look through some of the tutorials before posting but couldn't find much related to the game i wanted to make, so decided to post hoping someone could help with any advice or even experience making something similar!
I am making a educational flash game based on maths. The user is presented say 30 movieclips, 10 of these 30 movie clips equals two movie clips added together. For example, the user would click 1 and 3, and then another clip with a value of four, these clips would then disappear until the user worked there way down to no movie clips left and completed the game.
I have been able to create the variables using the following code:
for (i=1; i<7; i++) {
_root["q"+i+"a"].sum = random(20)+1;
_root["q"+i+"b"].sum = random(20)+1;
_root["ans"+i].sum = _root["q"+i+"a"].sum+_root["q"+i+"b"].sum;
}
My problems are after that... How would i allow the user to select two movie clips and an answer, and if it was correct it would remove the clips, otherwise it would reset and allow the user to select other clips. Also my answer movie clips are coloured blue and i want to implement code so that the user can only select these blue movie clips if they have selected two normal ones first? Any help would be greatly appreciated...
Bobby
Making An Active Desktop In Flash. Need Advice
Hi all. This is my first post here.
I'm in the process of attempting a Windows XP Active Desktop, done all in Flash. I have a few questions about doing so.
First. Normally, when you publish a page from Flash MX, there's a border on the html page, around the .swf. Is there a way to make the flash .swf take up the whole html page, with no borders? This will be necessary if I am to make an Active Desktop page.
Second. I want to put buttons on this Active Desktop to open up 'My Computer', 'My Pictures', 'My Music', etc. What commands can I add to the buttons to make them do this. First I tried a getURL action with the URL being "file://%WinDir%/explorer.exe" (for my computer) but it just says that it can't be found, even though when I type the same thing into IE 6.0, it brings up Windows Explorer. So, what actions can I use to do this?
That's it right now, but I'm sure I'll be back with more questions. Thanks in advance for any tips given.
Flash Images Are Lighter?
I did some research about color profiles between photoshop and flash and can't seem to get this to work. I'm putting together a photoshop web site mockup in dreamweaver and when I go to insert my flash swf file it inserts into the document properly except it's slightly lighter, while all the other image slices are darker. I tried to painstakingly match it but haven't been able to (by darkening the image in photoshop)..Can anyone shed some light on this matter? Thanks.
Images Look Lighter In Flash
I did a search for this but I did not find an answers. When I import a PNG into Flash it looks brighter and dull than it did in Photoshop. Has anyone noticed this? I have to go into PNG file and mess with the brightness and contrast to make it match. Is there a setting in Flash I have to change so I don't have to do this?
I'm working in CS2 and Flash 8 by they way.
Which Format Is Lighter In Flash? And A Problem....
Adobe Illustrator or .png?
I am having trouble importing illustrator files CS into Flash 5...import does not work (even when saving to earlier versions) and cut/paste screws up the type (even when converted to outlines).
Any help? It's been a year since I've done a flash project and am brain dead at the moment...it will slowly start to come back...
Thanks! CB
I Would Like Some Advice About Designing A Site In Flash & Using Actionscript
Everyone here has seemed to solve my problems with my other issues so I have another question.
Now I design most my sites in flash...yes I know this isn't good to do. But what else can I use that gives me basically the same freedom as flash. I like the way I can make a site in flash look, I like the idea of how i can make everything load in the middle of the page instead of reloading the whole page. Is there another program I can use to make a site look just as good as flash with the same freedom? I much rather design my sites in a different developer because flash requires so much from the viewer. So does anyone have any advice for me?
Thank You!
Newbee Seeks Advice - Flash 5 - Actionscript - Linking Video Swf Movie Clips
Hi Guy's
I am new to Flash 5 & Actionscript.. I have made a short video with my camcorder which I would like to display on a family webpage. I have split the movie into a series of short movie clips and converted them into swf movie clips to speed up the download and playback sequence.
I am now trying to create a continuous movie by linking the swf movieClips with Actionscript.
I have been Surfing the Web in the hope that I could find a short preloader script that I could learn from/modify to enable me to achive my goal..
After two frustrating weeks I have to admit that Actionscript is not as easy to use as some claim it to be.
Any help on this matter would be greatly appreciated..
Regards Jock
Need Advice In Making This File More AS
If anyone would mind taking the time to take a look at my file, I have got the AS working pretty nicely although have still needed to make my timeline quite long, if anyone can look and let me know what else I could control with AS would be greatly appreciated!
Need Advice In Making This File More AS
If anyone would mind taking the time to take a look at my file, I have got the AS working pretty nicely although have still needed to make my timeline quite long, if anyone can look and let me know what else I could control with AS would be greatly appreciated!
Need Advice In Making This File More AS
If anyone would mind taking the time to take a look at my file, I have got the AS working pretty nicely although have still needed to make my timeline quite long, if anyone can look and let me know what else I could control with AS would be greatly appreciated!
Making A Quote, Need Advice
I have a project manager who wants me to quote on a project doing something I've never done, but which I know is doable. Basically, it involves creating an application to determine the kind of printer cartridge that a printer needs. Here are the particulars:
1. The user selects a printer company
2. Based on selection 1, the user then is given a series of models to choose from
3. Based on selections 1 and 2, the application displays a compatible generic cartridge
4. The whole thing is linked to a database of several hundred categories. The database will be on the user's computer, the type of which is up to us.
I just need a rough idea of about how many hours to quote for. It doesn't need to be perfect, but I don't want to be way off as far as too high or too low. Can anyone give me a ballpark figure?
Need Advice In Making This File More AS
If anyone would mind taking the time to take a look at my file, I have got the AS working pretty nicely although have still needed to make my timeline quite long, if anyone can look and let me know what else I could control with AS would be greatly appreciated!
Need Advice In Making This File More AS
If anyone would mind taking the time to take a look at my file, I have got the AS working pretty nicely although have still needed to make my timeline quite long, if anyone can look and let me know what else I could control with AS would be greatly appreciated!
Advice On Making A Cd-rom. Embed Movie
Hi! I'm still around after a week or two of heavy work to do at job. Now i'm a little bit relaxed, i'm facing a new challenge with flash, and i need a little bit of advice.
I'm making a cd-rom for a friend of mine who has a rock band, and we want to include a video-clip of the band on it. I'm making the interface with flash and i was wondering if it was better to embed the movie into the proyector (if so, how do you do that??? Which is the better type of file for that??) or if its better to leave it outside the proyector and call it by fscommand.
If you leave it outside, the user must have the plug in to see the movie, right???
I gues its better to put the movie inside the proyector, because this way you'll get only one .exe file. But i have no idea of the way of doing that... (other way is making it swf??? But i need to know anyway the best way to embed it)
As you see, i'm a sea of doubt... any ideas??
Actionscript Making My Flash 8 .swf Too Big
Here's my report:
NewStartLeasingTowerBanner1.swf Movie Report
---------------------------------------------
Frame # Frame Bytes Total Bytes Scene
------- ----------- ----------- ----------------
1 399235 399235 Scene 1 (AS 2.0 Classes Export Frame)
2 2 399237
3 2 399239
4 2 399241
5 2 399243
6 2 399245
Scene Shape Bytes Text Bytes ActionScript Bytes
------------------------- ----------- ---------- ------------------
Scene 1 45 351 430
Symbol Shape Bytes Text Bytes ActionScript Bytes
------------------------- ----------- ---------- ------------------
NewStartLogo 0 0 0
ClickMore_mc 0 148 9
Font Name Bytes Characters
---------------------- --------- --------------
Arial Bold 1012 CMcefiklor
Arial 30
Impact 3623 ()-.013456789EMSadekorstux
ActionScript Bytes Location
------------------ --------
430 Scene 1:action:1
235
2 ClickMore_mc:actions:14
7 ClickMore_mc:Button_bg:14
355170 ActionScript 2.0 Classes
Bitmap Compressed Compression
----------------------- ---------- -------- -----------
NewStartLeasingLogo.png 12860 429312 JPEG Quality=70
Here's what appears for the action of Frame 1:
code: this.button_mc.onRollOver = function () {
button_mc.gotoAndPlay("_over");
}
this.button_mc.onRollOut = function () {
button_mc.gotoAndPlay("_out");
}
this.button_mc.onMouseDown = function () {
button_mc.getURL("http://ads.nandomedia.com/RealMedia/ads/click_lx.ads/www.durhamregion.com/dr/marketplace/automotive/1949856706/Button12/Metroland/dr-NEWSTART-paid-button12_auto/ns_wheels.gif/34356330643630643433613836313830");
}
I have a button_mc (movie clip button) placed on the main timeline, actions layer, at frame 1, with the above actions also placed at frame 1, on the same layer. Why is the simple action of clicking on this movie clip, to get to a web site, so darn large in resulting .swf file size? Is there a way to make it smaller? I'm assuming that because of the way I'm calling this, that it's getting exported to the .swf file as a "component"? The .fla file can be found here: Flash banner source . Thanks for all your help!
Gil Tennant
Actionscript > Flash MX (6) > Making A Chatbot
Hi all.
I am working on a small chatbot that will have conditioned responses depending on words a user types in.. So far, it is a failure.. Here is the code i have:
CODEon (release, keyPress "<Enter>") {
if (_root.user.text=="Hi") {
_root.reply.Text = "Hello";
_root.user.text = "";
}else{
_root.reply.Text = "I have no idea";
}
Lighter
Been helped out couple of times on this forum for which I thank you guys so I really hope that happens again this time. I'm working on a schoolproject for the moment and I made a lighter that starts working when you click on it. Me teacher isn't satisfied with that and wants it to work when you spin the 'wheel'. So does anyone know how I could do that, for example when you drag and turn a circle a quartercorner, it does the action you want ...
thx in advance
gr
ActionScript Newbie Making Interactive Flash
I apoligize if this is a repeated question, but I didn't understand any of the explanations I found in searches. I am making an interactive banner ad. On one layer I have an object, a movie clip symbol. I figured out that the code for others to drag it is:
//this line commands to drag the shape when you click on it
on(press) {
startDrag(this);
}
//this line releases the shape and shows the mouse again on the screen
on(release) {
stopDrag();
}
On another layer is the destination, a graphic symbol. Once the draggable object lands on the destination, I want a webpage to open. I believe I'm in over my head but maybe someone can help me.
Thanks!
ActionScript Advice
Hi there
I am designing a small application, in Version 6, the purpose of which is to be a visual aid for users to select a range of different garments and see what they will look like in a range of colours.
Each garment can have any one of a series of different artwork printed on it, which can be in any one of a range of different colours.
I’d like the user to:
Be able to choose the type of garment
Be able to change the colour of each garment
Be able to select the artwork for the garment
Be able to change the colour of the artwork
I’ve already hit my first problem, and at such an early stage too. I knew this project was beyond my capabilities but hey, he who dares…
I’m not sure of the best method to set the everything up. Should I make all the each piece of artwork into a separate swf’s and load it only when requested? Is it best practice to make each of the selection processes into a separate MC and make another for the viewing area?
So far, I have 5 MC’s on the stage:
garmentSelectMC
Contains buttons for each garment type (hoody, longsleeve, teeshirt, vest)
artworkSelectMC
Contains buttons for each.
viewerMC
This is where the garment and artwork will be loaded
garmentColourSelectMC
This will contain a series of buttons, each altering the colour of the garment in the viewerMC.
artworkColourSelectMC
This will contain a series of buttons, each altering the colour of the artwork, on the garment, in the viewerMC.
Please would someone be so kind as to spend a few moments helping me out? I would do the following:
garmentSelectMC
Each button loads a different garmentTypeMC into the viewerMC. The initial colour will always be white.
artworkSelectMC
Each button will load a new artworkTypeMC into the viewerMC, on the level above the garmentTypeMC so that it will always be visible.
garmentColourSelectMC
Each button will change the colour of the fill in the current garmentTypeMC.
artworkColourSelectMC
Each button will change the colour of the fill in the current artworktTypeMC.
Is the best way to create functions for each operation, such as loading the appropriate garment when a button is pressed? And is this best achieved by passing variables to the function?
Oh, I get so confused but am loving the challenge of learning scripting really fun. I just can’t wait until it all makes sense. I feel that I am on the cusp of realisation but need some well needed help from someone who has already tamed the beast, so to speak.
Actionscript Advice
Please can anybody out there help!!!
I have several movieclips which contain buttons to make that mc play. Once all of the buttons in each mc have been released and all mc's have played, I need to be able to gotoAndPlay the next frame or scene. The user shouldn't be able to goto the next frame/scene if all the movie clips haven't played/ buttons released. Does anybody know the actionscript needed to perform such an event???
Cheers
Actionscript Advice In Need
Quite hard to explain but here i go,
I have several movie clips which are aligned over each other. All of them contain a button to play the 'mc'. I have use the swapdepths script to make the mc arrange to the front when that mc's button is rolled over. When the movieclip selected is playing, it gets to a stop frame where text appears. The problem is the other mc's and their buttons are visible (intentionally) but are also active. When the user rolls over them they obviously start playing over the top of the mc currently on. What I desperately need is some script or method to make the buttons of the other mc's inactive when the front clip is playing??
I've racked my brains, and best I've come up with is to place a hidden button over the mc's button i want inactive. Although this prevents the user being able to rollover the mc buttons, it obv makes the cursor change which looks confusing for the user!
Please someone out there must be able to firstly understand what I banging on about and secondly hopefully a solution.
Cheers
Actionscript Advice
Quite hard to explain but here i go,
I have several movie clips which are aligned over each other. All of them contain a button to play the 'mc'. I have use the swapdepths script to make the mc arrange to the front when that mc's button is rolled over. When the movieclip selected is playing, it gets to a stop frame where text appears. The problem is the other mc's and their buttons are visible (intentionally) but are also active. When the user rolls over them they obviously start playing over the top of the mc currently on. What I desperately need is some script or method to make the buttons of the other mc's inactive when the front clip is playing??
I've racked my brains, and best I've come up with is to place a hidden button over the mc's button i want inactive. Although this prevents the user being able to rollover the mc buttons, it obv makes the cursor change which looks confusing for the user!
Please someone out there must be able to firstly understand what I banging on about and secondly hopefully a solution.
Cheers
Actionscript Advice
Hi,
I basically have two flash swfs which need placing in an HTML template which has navigational buttons. Once the first swf has played/complete, I need to send a message to the javascript to allow the user to click the 'next' button (in the HTML template) to then play the second swf. The 'next' button will be inactive until the first swf has completely played. So will need the actionscript to tell the javascript the swf is complete. Think you use the fscommand, but not sure as this the first time I've had to link flash and HTML code together.
Hope someone can help...
Actionscript Advice In Need
Hi,
I basically have two flash swfs which need placing in an HTML template which has navigational buttons. Once the first swf has played/complete, I need to send a message to the javascript to allow the user to click the 'next' button (in the HTML template) to then play the second swf. The 'next' button will be inactive until the first swf has completely played. So will need the actionscript to tell the javascript the swf is complete. Think you use the fscommand, but not sure as this the first time I've had to link flash and HTML code together.
Hope someone can help...
Actionscript Advice In Need
Hi,
I basically have two flash swfs which need placing in an HTML template which has navigational buttons. Once the first swf has played/complete, I need to send a message to the javascript to allow the user to click the 'next' button (in the HTML template) to then play the second swf. The 'next' button will be inactive until the first swf has completely played. So will need the actionscript to tell the javascript the swf is complete. Think you use the fscommand or geturl, but not sure as this the first time I've had to link flash and HTML code together.
Hope someone can help...
Actionscript Advice
For a wile now ive been watching dvds and other tutorials on actionscript. Thats all good but when it comes to desinging stuff for my portfolio I just dont seem to have the answer or code to do what I want to do. I think I need some classes or some tutoring on how to do some advanced to stuff to make some custome scripts. What should I do to get my head deeping into code so that i can take care of my all my works. What would be the best thing to do. Im willing to do alot!
Thanks
No Advice On Actionscript?
hey I posted some files on an earlier post, I'm just wondering if anyone has any advice? I've not heard anything back..
I'm stuck on this one thing, and can't figure out what script I'm supposed to use where..
thanks!
-Abner
Png Files Look Lighter On Import Why?
Hey All,
Anyone experience .png files appear lighter on import?
I know this isn't an actionscript question just figured I ask the most folks.
running mac G5 with CS2
cheers
jub
Image Goes Lighter When Importing?
Hi
I have created a graphic in photoshop and then have saved it out as jpeg & png etc all at the highest qualitys i can!! but whenever i import it into flash its looses its colour!! it goes dull!! alot lighter!!
anyone know a way around this???
Image Goes Lighter When Importing?
Hi
I have created a graphic in photoshop and then have saved it out as jpeg & png etc all at the highest qualitys i can!! but whenever i import it into flash its looses its colour!! it goes dull!! alot lighter!!
anyone know a way around this???
Which Is Lighter Weight: Button Or MC?
In the beginning I was thinking Buttons would be lighter weight for Flash, simpler and smaller footprint. Now I'm thinking they are perhaps not native but just derived from movieclips and thus in fact heavier. Which is it?
First Attempt At Actionscript, Could Use Some Advice Please
Hi there,
This is my first attempt at actionscript and I've got the main idea of what I want to do, but for some reason it has stopped loading images. If you view the site here: http://www.krammedia.com/vellecadesign/2005/base.html then click on Gallery and then click on Doors, then click on the first thumbnail. You should get that fade in and then 4 thumbnails appear in bottom corner, which you can switch between.
If you go back to Doors menu and click on the second thumbnail it will load the text, the thumbnails (all from an xml file) but not the first image. The images are all there and are the exact same format as the ones that work orginally. I first build this about 2 months ago with a few images, but ever since I've added the new images to the xml file it does not show them.
Here is the code that receives 2 values, a category id and an item id that loops through the cat in the xml file and finds the correct item and then returns all the text and thumbs etc:
ActionScript Code:
function loadGallery(intCat, intNum) {
function xmlLoad(loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
//first loop through categories to identify right one
for (i=0; i<total; i++) {
if (xmlNode.childNodes[i].attributes.catid == intCat) {
//then count and loop through items in category until found specific item
itemTotal = xmlNode.childNodes[i].childNodes.length;
for (s=0; s<itemTotal; s++) {
if (xmlNode.childNodes[i].childNodes[s].attributes.itemID == intNum) {
idParam_txt.text = intNum;
title_txt = xmlNode.childNodes[i].childNodes[s].childNodes[0].firstChild.nodeValue;
desc_txt = xmlNode.childNodes[i].childNodes[s].childNodes[1].firstChild.nodeValue;
thumbCount = xmlNode.childNodes[i].childNodes[s].childNodes[3].childNodes.length;
image_arr = [];
for (z=0; z<thumbCount; z++) {
image_arr[z] = xmlNode.childNodes[i].childNodes[s].childNodes[3].childNodes[z].firstChild.nodeValue;
trace(image_arr[z]);
}
}
}
}
}
runMovie();
} else {
trace("what xml file");
}
}
// end of loadgallery function
function loadText() {
var myStaticB:TextFormat = new TextFormat();
myStaticB.bold = true;
myStaticB.font = "Arial";
myStaticB.align = "left";
myStaticB.size = 11;
var myStatic:TextFormat = new TextFormat();
myStatic.bold = false;
myStatic.font = "Arial";
myStatic.align = "left";
myStatic.size = 11;
_level0.container07.menuback.loadme._visible = false;
_level0.container07.menuback.itemTitleText._visible = true;
_level0.container07.menuback.itemTitleText.itemTitleText.text = title_txt;
_level0.container07.menuback.createTextField("galDesc_txt", 1600, 10, 80, 180, 260);
with (_level0.container07.menuback.galDesc_txt) {
setTextFormat(myStatic);
setNewTextFormat(myStatic);
text = desc_txt;
multiline = true;
wordWrap = true;
selectable = false;
}
}
function buildBackButton(intCat) {
switch (intCat) {
case "1" :
backText = "gates";
break;
case "2" :
backText = "doors";
break;
case "3" :
backText = "railings";
break;
case "4" :
backText = "furniture";
break;
case "5" :
backText = "sculpture";
break;
case "6" :
backText = "other";
break;
default :
backText = "gallery";
}
_level0.container07.menuback.loadme3.backButton.back_mc.backToText.backToText.text = backText;
_level0.container07.menuback.loadme3._visible = true;
_level0.container07.menuback.loadme3.onEnterFrame = function() {
_level0.container07.menuback.loadme3.backButton.onPress = function() {
_level0.container07.menuback.itemTitleText._visible = false;
_level0.container07.menuback.galDesc_txt.removeTextField();
_level0.container07.menuback.backHolder.unloadMovie();
_level0.container09.fadeGallery();
_level0.container09.fadeIn(4);
_level0.container07.menuback.loadme2._visible = true;
_level0.container07.menuback.loadme2.buildBackButton();
};
};
}
function runMovie() {
currentHolder = 0;
theDepth = 12;
_global.imageLoaded = false;
_root.container06.createEmptyMovieClip("img0_mc", theDepth++);
_root.container06.createEmptyMovieClip("img1_mc", theDepth++);
_root.container06.img0_mc._y = 0;
_root.container06.img1_mc._y = 0;
_root.container06.createEmptyMovieClip("thumbloader", theDepth++);
for (var i = 0; i<image_arr.length; i++) {
_root.container06.thumbloader.createEmptyMovieClip("thumb"+i+"_mc", theDepth++);
_root.container06.thumbloader.createEmptyMovieClip("thumb"+i+"_tmp_mc", theDepth++);
_root.container06.thumbloader["thumb"+i+"_mc"]._x = 670-65*i;
_root.container06.thumbloader["thumb"+i+"_mc"]._y = 360;
_root.container06.thumbloader["thumb"+i+"_mc"].loadMovie("images/jobs/"+image_arr[i]+"_thumb.jpg");
//trace("imagedesc: "+image_arr[i]);
_root.container06.thumbloader["thumb"+i+"_tmp_mc"].no = i;
_root.container06.thumbloader["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
if (this._parent["thumb"+this.no+"_mc"]._width>1) {
this._parent["thumb"+this.no+"_mc"].num = this.no;
this._parent["thumb"+this.no+"_mc"].onPress = function() {
loadImage(this.num);
};
delete this.onEnterFrame;
this.removeMovieClip();
}
};
}
loadImage(0);
// thumbloader background bar
_root.container06.thumbloader.attachMovie("thumbloaderback", "testback", theDepth-100);
xPos = 740-((thumbCount*60)+(((thumbCount-1)*5)+25));
xPosClosed = ((thumbCount*60)+(((thumbCount-1)*5)+10));
_root.container06.thumbloader.testback._x = xPos;
_global.xPosClosed = xPosClosed;
_root.container06.thumbloader.testback._y = 353;
// end of thumbloader background bar
function loadImage(num) {
_root.container06["img"+currentHolder+"_mc"]._x = 0;
_root.container06["img"+currentHolder+"_mc"]._y = 100;
_root.container06.createEmptyMovieClip("img0_tmp_mc", theDepth++);
_root.container06.createEmptyMovieClip("img1_tmp_mc", theDepth++);
_root.container06["img"+currentHolder+"_mc"].loadMovie("images/jobs/"+image_arr[num]+".jpg");
//trace(image_arr[num]);
_root.container06["img"+currentHolder+"_tmp_mc"].onEnterFrame = function() {
if (this._parent["img"+currentHolder+"_mc"]._width>1) {
this._parent["img"+currentHolder+"_mc"]._y = 0;
this._parent["img"+currentHolder+"_mc"]._alpha = 1;
_global.imageLoaded = true;
delete this.onEnterFrame;
this.removeMovieClip();
}
};
_root.container06["img"+((currentHolder+1)%2)+"_tmp_mc"].onEnterFrame = function() {
if (_global.imageLoaded) {
if (this._parent["img"+currentHolder+"_mc"]._alpha<100) {
this._parent["img"+currentHolder+"_mc"]._alpha += 15;
this._parent["img"+((currentHolder+1)%2)+"_mc"]._alpha -= 15;
} else {
this._parent["img"+currentHolder+"_mc"]._alpha = 100;
this._parent["img"+((currentHolder+1)%2)+"_mc"]._alpha = 0;
currentHolder = (currentHolder+1)%2;
delete this.onEnterFrame;
this.removeMovieClip();
}
}
};
}
loadText();
buildBackButton(intCat);
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = xmlLoad;
xmlData.load("xml/images.xml");
}
and here is a portion of the xml that it is reading:
Code:
<category catid="2" catText="Doors">
<item itemID="3">
<title>Entry Door</title>
<description>HINGING GRILLS ON A WOOD FRAME DOOR RELEASED BY A THUMBTURN FOR EASE OF CLEANING. THE UNIQUE LEAF FORM LENDS ITSELF WELL TO THE FLOWING MOVEMENT IN THIS CUSTOM DESIGN.</description>
<image>item3_1</image>
<thumbs>
<thumb>item3_1</thumb>
<thumb>item3_2</thumb>
<thumb>item3_3</thumb>
<thumb>item3_4</thumb>
</thumbs>
</item>
<item itemID="11">
<title>Wine Door</title>
<description>FROM THE SUBTELY FORGED TRELLIS AND FINELY FORMED LEAVES, TO THE ROUGHLY TEXTURED GRAPES AND VINE STALKS, FINE CRAFTSMANSHIP IS APPARENT IN THIS PIECE. WHILE COMPLEMENTING THE PIECE AS A WHOLE, EVERY ELEMENT HAS BEEN TREATED AS AN INDIVIDUAL CHARACTER AND GIVEN ITS OWN GESTURE. SUBTLE COLORING FINISHES THIS ELEGANT DESIGN WHILE REVEALING THE AUTHENTIC TEXTURES BORN OF THE UNIQUE FORGING PROCESSES EMPLOYED. THIS DOOR IS AS ORIGINAL AND NATURAL AS THE MANY VINES STUDIED WHILE DESIGNING IT.</description>
<image>item11_1</image>
<thumbs>
<thumb>item11_1</thumb>
<thumb>item11_2</thumb>
</thumbs>
</item>
</category>
Sorry for such a long post, but this is starting to do my head in now. I know it may not be the best coding or approach (coz I need to wrap some preloaders around the images loading - if anyone can help with that as well), but as it's my first attempt, I'm quite pleased with it... if only it did what I want.
Many thanks in advance for any help or advice you can offer.
Regards
Mark
Actionscript Advice Needed
right, i know there is a lot of code pasted here but ive cut out the bits that dont need changing!!
basically im stuck on this now, i have a motion detection actionscript program running and counting the number of pixels with movement in them...
the timer now works and only certain movie clips are used at certain times, however i want to reset the 'count' variable so that it starts counting from 0 again when a new minute is started...
How can I reset the counter for each time period? or how could I put in a new variable for each time period?
var count = 0;
var my_date: Date = new Date();
function snap() {
// code cut down
var nine = 0;
var total = 0;
// code cut down
if (d>tolerance) {
count = count+1;
nine = count;
ten = count;
total = count;
// code cut down
}
}
}
var my_date: Date = new Date();
if (my_date.getMinutes() == 24) {
if (nine>50) {
mc_nine.gotoAndStop(2);
if (nine>100) {
mc_nine.gotoAndStop(3);
if (nine>150) {
mc_nine.gotoAndStop(4);
if (nine>200) {
mc_nine.gotoAndStop(5);
if (nine>250) {
mc_nine.gotoAndStop(6);
}
}
}
}
}
}
if (my_date.getMinutes() == 25) {
if (ten>50) {
mc_ten.gotoAndStop(2);
if (ten>100) {
mc_ten.gotoAndStop(3);
if (ten>150) {
mc_ten.gotoAndStop(4);
if (ten>200) {
mc_ten.gotoAndStop(5);
if (ten>250) {
mc_ten.gotoAndStop(6);
}
}
}
}
}
}
if (count>0) {
total = count;
trace(total);
}
updateAfterEvent();
before = now.clone();
}
Advice On ActionScript Transition
I've hitherto been mostly on the design end of creativity, but have recently been incorporating the development end as much as needed (scripting, AJAX, etc.). I've had to take learning AS coding more seriously than just dragging and dropping objects and Actions code, and had picked up ActionScript for Dummies, which teaches AC2 (just started the book, though).
Now that AC3 is mostly reworked from the ground up, I need to get a book on it also and here's my question:
Should I finish reading and fully learning the first book on AC2, then learn from the new book on AC3, or do I ditch the old one entirely and just focus on AC3? Will a "blank mind" pick up AC3 better than one already trained on AC2 and then having to make the switch? Or will knowldge of AC2 actually help build up to AC3?
Also, I'd appreciate any recommended books on AC3 (I could go with another "For Dummies" edition but they may not necessarily the best). Much appreciated.
Advice From You Actionscript Gurus
Hey pepes,
I am trying to learn actionscript 2.0 for real, but I am having a hard time.
How did you go about learning it?
I would love to hear this from everyone who reads this and knows actionscript well, so I can do the same to learn it.
Thanks -O
Need Advice For Learning OOP Actionscript 3
I want to learn OOP as3 but dont want to learn from bad examples or bad information.
where are some places i can see this being used in .fla/.as examples, and good tutorials that can also help me?
i want to hav a strong understanding, and im reading "Object-Oriented ActionScript 3.0" but would like to see some examples also.
i have had trouble finding good ones via google
thank u
-joey
Advice For An Actionscript Beginner
I'm currently learning Actionscript. I have a working script for a navbar using movie clips with button properties, but I'm sure the code could be much leaner than this. Do I really need to repeat all this for each button? Any tips?
Here's the code:
var desVar = 0;
_global.desTxt = "This is a set of buttons";
// button 1
_global.btnCol1 = new Color("navbarMov_mc.btn1_mc.btnColor_mc");
_global.btnCol1.setRGB(0xFFAA77);
navbarMov_mc.btn1_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn1_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section1";
};
// button 2
_global.btnCol2 = new Color("navbarMov_mc.btn2_mc.btnColor_mc");
_global.btnCol2.setRGB(0xFF9966);
navbarMov_mc.btn2_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn2_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section2";
};
// button 3
_global.btnCol3 = new Color("navbarMov_mc.btn3_mc.btnColor_mc");
_global.btnCol3.setRGB(0xFF8855);
navbarMov_mc.btn3_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn3_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section3";
};
// button 4
_global.btnCol4 = new Color("navbarMov_mc.btn4_mc.btnColor_mc");
_global.btnCol4.setRGB(0xFF7744);
navbarMov_mc.btn4_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn4_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section4";
};
// button 5
_global.btnCol5 = new Color("navbarMov_mc.btn5_mc.btnColor_mc");
_global.btnCol5.setRGB(0xFF6633);
navbarMov_mc.btn5_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn5_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section5";
};
// button 6
_global.btnCol6 = new Color("navbarMov_mc.btn6_mc.btnColor_mc");
_global.btnCol6.setRGB(0xFF5522);
navbarMov_mc.btn6_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn6_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section6";
};
// button 7
_global.btnCol7 = new Color("navbarMov_mc.btn7_mc.btnColor_mc");
_global.btnCol7.setRGB(0xFF4411);
navbarMov_mc.btn7_mc.onRollOver = function() {
with (_root.navbarMov_mc.btn7_mc) {
gotoAndPlay(2);
}
with (_root.navbarMov_mc.description_mc) {
gotoAndPlay(1);
}
_global.desTxt = "section7";
};
Make Movieclip Lighter When Mouse Over?
Hello, how do i make a movieclip lighter when the mouse hovers over it?
or the content inside?
i have lots of thumbnails and want to make it more transparent when they hover over it...
How Make The Videos Lighter To Be Played
Hi,
We are deploying a flash 8 video application to run locally (so the file size don't matter, not much), but the playback performance we are getting so far is poor.
What we would like to achive is to full a 800X600 screen and still get a flawless video / audio quality. What should be the approach to be used? In the same hardware where we are getting poor playback performance in Flash 8 we get a great performance and much better quality running similar Divx/Xvid videos.
Maybe we should use an old codec? How? Because as we don't need to save loads of space on the disk we could choose to have a bigger file but lighter to be decoded. What do you guys think about that?
P.S.: The FLV video we have tested was: http://cdn-ce-wland-t2-02.ce.cdnfan03.icdn.comcast.net/CDNFan03/m_SonyPictures/210/440/Spider_Man3_SD_Franchise_Blacksuit.flv
Cheers
How Make The Videos Lighter To Be Played
Hi,
We are deploying a flash 8 video application to run locally (so the file size don't matter, not much), but the playback performance we are getting so far is poor.
What we would like to achive is to full a 800X600 screen and still get a flawless video / audio quality. What should be the approach to be used? In the same hardware where we are getting poor playback performance in Flash 8 we get a great performance and much better quality running similar Divx/Xvid videos.
Maybe we should use an old codec? How? Because as we don't need to save loads of space on the disk we could choose to have a bigger file but lighter to be decoded. What do you guys think about that?
P.S.: The FLV video we have tested was: http://cdn-ce-wland-t2-02.ce.cdnfan03.icdn.comcast.net/CDNFan03/m_SonyPictures/210/440/Spider_Man3_SD_Franchise_Blacksuit.flv
Cheers
Actionscript Menu Advice Needed....
Hi guys.
I'm making a flash menu but don't know the best way to do it and I wondered if anybody could offer some advice on how to implement it......I'll try to explain what I want.......
Let's say I have 5 thumbnail images which are my 5 menu options (namely a,b,c,d,e). On my screen I want to display 3 at a time, and scroll through them horizontally like so......
a B c
....click a right arrow
b C d
....click right arrow
c D e
etc etc. Note how I want the size of the thumbnail to change too. I hope this makes sense. I've not a clue how to do this, but am semi-ok at actionscript so advice would be appreciated......
Actionscript Movie Clip Advice
After reading what wrote in the last post, needed to re-write my problem as was unclear.
Basically I have a set number of movie clips with self contained btns, once each clip has played the timeline advances to the next scene where more clips with the same functions lie. I have some script which works fine but wont work again on the following scene. The code is below and all movie clips, buttons and frame labels have been adjusted for the two different scenes. However think something needs changing in the second code to perhaps point at the root timeline of the 2nd scene. The code is as follows:
>mc1.btn1.onPress = function() {
>mc1.play();
>if (!this.played) {
>this.played = true;
>_root.movieStarted++;
>if (_root.movieStarted == 7) {
>this._parent.onEnterFrame = function() {
>if (mc1._currentframe == mc1._totalframes) {
>delete this.onEnterFrame;
>_root.gotoAndPlay("next");
};
}
}
};
Please help!!!
How Can I Make My Site Lighter And Load Faster?
Hello.
I am a self taught flash user so a lot of my information and education within flash is sporadic.
Question: I have completed a flash movie (site) and it is composed of 25 different scenes. With one preloader at the beginning. The whole swf. file is around 67 megs. I would like to break this up into three or more separate movies (swf.) so it loads fast and runs smoother. How do I do this and link it properly?
How would I write the loadmovie script?
Calculating A Lighter Shade From A Passed Color
Hi everyone! This place is great and the website is a big help.
I'm trying to write a function for the purpose of generating a gradient fill from only one passed color. How can you take a passed color (0x0066cc, a blue, for example) and calculate a much lighter (almost white) shade of blue from it?
Any help would be much appreciated! Thanks again for all the previous aid I've gotten from you guys.
I Need Good Advice(combo Box,basic Actionscript) Please Help
Thank you for reading this, i need some help with the Combox in flash8.
I know this is relatively simple to do but i cant find any clear help on how to make three combo boxes each with its own info to relate to you last choice.
its for a site, i need 3 dependable combo boxes
the first box: media type,each selection has sizes in its data(canvas,digital print,hand print,ect..)
the second box: size, according to slection of box (30X40,30X20,24X19ect..)
the third box: price, acording to the size and media(£20,$40ect...)
obviously i dont understand event listeners at all. please please someone help me understand how to make 3 boxes link with oneanother.
thank you
very much
Kc
|