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








Code Problem


on (release) {
_root.switchSection("kamera1");
}

I use this code for a button. It basicly tells the button to switch .swf files in the main movie. Now, i need to design a MC so that this script would work on the last keyframe. I know the "ON" command will not work. How can i do it?

Tia
Dave




FlashKit > Flash Help > Flash MX
Posted on: 10-09-2003, 11:27 AM


View Complete Forum Thread with Replies

Sponsored Links:

[F8] Loading And Unloading External SWF Code Issues, Code Check Please
Okay, I'm still clumsy with AS and I'm having problems loading and unloading external SWFs. I have SWFs created by others in Captivate that need to be controlled by a main menu. I created the menu and buttons and have been trying to code it so that with the button click, the appropriate external SWF loads in an empty movie clip, plays, and then closes at the final frame and returns to the menu. So far, I can get it to load, but then I'm stuck as I'm not sure what I'm missing as far as it reading the frame numbers.

Here's the code I've written. I can't seem to get my idea for the onEnterFrame function checking the frames to work.

What am I missing? Can anyone offer any suggestions or guidance? Thanks!


Code:
this.createEmptyMovieClip("clip1", 1);

myfirst_btn.onRelease = function() {
clip1.loadMovie("externalswf1.swf");
}

mysecond_btn.onRelease = function() {
clip1.loadMovie("externalswf2.swf");
}

mythird_btn.onRelease = function() {
clip1.loadMovie("externalswf3.swf");
}

clip1.onEnterFrame = function() {
if (clip1._currentframe == clip1._totalframes) {
// remove move clip1 and return to menu
clip1.removeMovieClip();
}
}

View Replies !    View Related
External SWFs, Code Works But Not With Additional Code
I'm using a loadMovie code that works perfect by itself, but when I add additional code to the button, it doesn't work.

Here's the scenario:

I have an MC named songs In this MC I have several buttons that should each perform very similar actions.

The first action is a:

gotoAndPlay("somewhere"); action that takes the movie to a specific frame of this MC. This code by itself works fine.

The second action I need to happen is:

this.contents.loadMovie("music1.swf") which loads an external SWF which is nothing more than an MC with an audio clip. This code, by itself works fine.

The problem comes when I combine the two codes to create:

on (release)
{
gotoAndPlay("somewhere");
this.contents.loadMovie("music1.swf");
}

The movie does go to the "somewhere" frame, but the external SWF no longer loads.

I have tried it with _root.songs.contents.loadMovie("music1.swf");

I have tried placing the loadMovie code first, but neither of those solutions work.

Any ideas?

Thanks

View Replies !    View Related
Help> How To Remove Part Of The Code Without Breaking The Entire Code
I use the following code on my website (http://www.misenplace.com.br ), it`s a fading out script that shows a banner underneath it.

I want to remove the pagetitle, welcome, date and sitename, but I can`t figure it out since when I remove something the movie doesn`t load or it doesn`t fade out as it was supposed to.

here`s the code


Quote:




var imgLoader = new MovieClipLoader();
var mindepth = welcome_txt.getDepth();
mindepth = mindepth < pagetitle_txt.getDepth() ? (mindepth) : (pagetitle_txt.getDepth());
mindepth = mindepth < date_txt.getDepth() ? (mindepth) : (date_txt.getDepth());
mindepth = mindepth < sitename_txt.getDepth() ? (mindepth) : (sitename_txt.getDepth());
var maxdepth = welcome_txt.getDepth();
maxdepth = maxdepth > pagetitle_txt.getDepth() ? (maxdepth) : (pagetitle_txt.getDepth());
maxdepth = maxdepth > date_txt.getDepth() ? (maxdepth) : (date_txt.getDepth());
maxdepth = maxdepth > sitename_txt.getDepth() ? (maxdepth) : (sitename_txt.getDepth());
this.createEmptyMovieClip("imageHolder_mc", mindepth - 1);
imageHolder_mc._x = 0;
imageHolder_mc._y = 0;
imageHolder_mc._alpha = 0;
imageHolder_mc.duplicateMovieClip("imageMasker_mc" , maxdepth + 1);
imageMasker_mc._alpha = 0;
imgLoader.loadClip(imageName, imageHolder_mc);
imgLoader.loadClip(imageName, imageMasker_mc);
welcome_txt.text = themessage;
welcome_txt._visible = false;
welcome_txt.autoSize = true;
var sitename_str = pagetitle;
var pagetitle_str = "";
var pos = sitename_str.indexOf(" - ");
if (pos > 0)
{
pagetitle_str = sitename_str.substr(pos + 3);
sitename_str = sitename_str.substr(0, pos);
} // end if
pagetitle_txt.text = pagetitle_str;
pagetitle_txt._visible = false;
pagetitle_txt.autoSize = true;
sitename_txt.text = sitename_str;
sitename_txt._visible = false;
sitename_txt.autoSize = true;
var curdate = new Date();
var date_str = curdate.toString();
var pos = date_str.indexOf(":");
var datestr = date_str.substr(0, pos - 3);
datestr = datestr + (", " + date_str.substr(date_str.length - 4));
date_txt.text = datestr;
date_txt._visible = false;
date_txt.autoSize = true;
imgLoader.onLoadComplete = function (targetMC)
{
_root.onEnterFrame = function ()
{
if (imageHolder_mc._alpha < 100)
{
imageHolder_mc._alpha = imageHolder_mc._alpha + 3;
}
else
{
if (!welcome_txt._visible)
{
welcome_txt._visible = true;
pagetitle_txt._visible = true;
sitename_txt._visible = true;
date_txt._visible = true;
imageMasker_mc._alpha = 100;
} // end if
imageMasker_mc._alpha = imageMasker_mc._alpha - 3;
if (imageMasker_mc._alpha <= 0)
{
delete _root["onEnterFrame"];
} // end if
} // end if
};
};






thanks a lot everyone

View Replies !    View Related
Movieclip Code Interacting With Document Class Code
I'm coding an application in Flash CS3 but relying heavily on doing most of the heavy lifting in actionscript3. I've set a document class (i.e. package me.mine{ class Main extends Sprite(){} }) with most of the code necessary.

In my Library I've got a Movie Clip for a control panel. I instantiate the movie clip from the Main class. This movie clip will change itself around (an off state and an on state with different menu options) - and i want to be able to add a button within the clip, and when it's clicked, have it call out to a function in the the Main class.

But I can't figure out how to get the MovieClip to talk to the Main class (I can set event listeners from the Main class on elements in the clip, but the clip will change around so I want it to work in the other direction).

Thanks for your help!

View Replies !    View Related
How Do I Execute Code Then Move To Another Frame When Code Is Finished And Run More?
hello. im well new to flash and im tring to build a cool flash movie using MC Tween in action script. my problem is i want to execute soem code then whenits finisd move on to frame 5 which has more code in it and then execute that code and so on how do i achieve this.
thanks

View Replies !    View Related
Code - What Code? You Didn't Spend Hours Writing It.
Hello,

Has anyone had a problem where sometimes (for no apparent reason) flash doesn't retain your code after you save and quit and then reopen the fla?

I used to think this was happening due to my backup app., but it's not running anymore. I even saved an additional copy of the file on my desktop AND dragged another copy to another folder. Everything was missing the same code.

We I published the swf before exiting, it worked perfectly.

Any ideas for fixes? Running os 10.3. Tried getting rid of prefs - no luck.

This is getting annoying. Happens with every fla I'm editing.

Thanks,
Ward

View Replies !    View Related
Newbie Convert Button Code To Frame Code
Hi all!

I guess this is a really simple one.

I have a button with the following code attached to it:


PHP Code:



this.onRelease = function() {    SWFAddress.setValue('/portfolio/');}this.onRollOver = function() {    SWFAddress.setStatus('/portfolio/');}this.onRollOut = function() {    SWFAddress.resetStatus();} 




I want to use this code on a frame. Is it onLoad I need to use??

View Replies !    View Related
My Code Has No Friends: The Story Of My Sucky Code
I have an text input. I want it so that when you hit enter, it'll do stuff.

I want one of the commands to be...

goto

...however, here's the issue:



onClipEvent (enterFrame) {
pressed = Key.getCode();
pinputinn = pinput.toLowerCase();
if ((pinputinn == "goto") and (pressed == 13)) {
gotoAndStop (2);
}
}


Could someone tell me why that doesn't work, and what would work?
[Edited by Crickett on 07-20-2001 at 11:17 PM]

View Replies !    View Related
No Flash And No Embed Code In Source Code?
I really dont know whats going on here, when i try to embed my flash into a html or php document the flash movie does not appear when browsing, when i view source the code is not even there but all other code changes are reflected (i know the document has been updated). When i go direct to the swf url I can see the file. when i publish the swf with html it works fine locally but again online i cant even see the code. other flash files work fine on my site, this is a problem on IE and firefox.. whats going on???????

View Replies !    View Related
[F8] Help. Integrate Cpu Check Code With Preloader Code
Hi, guys!

I was looking for a way to do a cpu check over the user´s computer and then, based on the user´s cpu speed, redirect his browser towards one of two different versions of the same flash movie (let´s say, a "light" one without effects and a "full" one with all the effects). I´ve already got a fine working preloader, and I´ve found a nice cpu check code here in this forum. The problem now is that I am not able to put them together. Something like, after a mouseclick, perform the cpu check and after that load a movie based on the previous cpu check...

I am posting my fla and the original cpu check fla that I´ve found here to show what I´ve got so far.

Thanks in advance!

View Replies !    View Related
[F8] Sound Code Does Not Work Unless It Is The Last Line Of Code?
Hi.

My code _root.sndBeep.start(); will not play a sound no matter where in my onEnterFrame function I put it, unless it is the last line of code in that function.

Anyone know how that is possible?

Example code:


PHP Code:



onEnterFrame = function(){        // Tons of code above this point not worth posting.    _root.sndBeep.start(); // This sound will never play WHY??    if (Hearts < 3 && Hearts != 0)    {                if (!bLowHealthPlaying)        {            _root.sndLowHealth.start(0,99999);            bLowHealthPlaying = true;        }    }    else    {        _root.sndLowHealth.stop();        bLowHealthPlaying = false;    }    _root.sndBeep.start(); // Yet the sound works perfectly fine here??}

View Replies !    View Related
I Need Some Basic Help Getting My Pseudo Code Into Working Code
id appreciate a hand from you guys, if you could.

ive got a fla (575x431) that im making for an image gallery.... i will have 20 images that will be icons probably 40-50% smaller than the full size image these will be movie clips that i will assign a very slow random movement to
i think that i have the random part ok, i just need some help with this part...

pardon me if my terminology isnt right..

If mouse (over) a mc, then;
stop mc, show mc label, title.

If mc is clicked, then;
enlarge scale of mc (ie, 100%) and center it on the stage.

If mouse (out) then;
return mc size to its former state and continue moving randomly.


hope this makes sense would really appreciate some direction....

thanks alot

løk

View Replies !    View Related
Javascript Code To Actionscript Code?
I have some actionscript code that makes a really cool clock effect. I was wondering if anyone knew how to convert the javascript code to actionscript or if it is even possible to do. If not, does anyone know how to recreate the effect in flash/actionscript? You can view the actual javascript effect by going to www.uncontrol.com and clicking on the clock file. The javascript code is as follows:

Thanks for any help...

-- K



__________________________________________________ ______



// clock
// created using proce55ing application | www.proce55ing.net
// copyright© www.uncontrol.com | mannytan@uncontrol.com

// ************************************************** **********************
// initialize
// ************************************************** **********************
boolean mouseStatus = false;
boolean priorMouseStatus = false;
int x, y, z;
int i, j, k;
float counter=1;
String time,s_hour,s_min, s_sec;
float pos_x, pos_y;
float radius;
float SECOND_INC = .0166;// 1/60
float MINUTE_INC = .0166;// 1/60
float HOUR_INC = .0833;// 1/12
float current_sec, current_min, current_hr;
float radian_percentage;
// ************************************************** **********************
// set up
// ************************************************** **********************
void setup() {
size(400, 400);
background(255);
hint(SMOOTH_IMAGES);

BFont ocr;
ocr = loadFont("OCR-B.vlw.gz");
setFont(ocr, 16);
ellipseMode(CENTER_DIAMETER);
rectMode(CENTER_DIAMETER);
}

// ************************************************** **********************
// listeners
// ************************************************** **********************
void mousePressed() {
mouseStatus = true;
}
void mouseReleased() {
mouseStatus = false;
}

void loop() {
translate(width/2, height/2);
radian_percentage = ((mouseY+.0001)*.0025);
rotateX(TWO_PI * radian_percentage * -1);

// --------------------------------------------
// analog marks numbers
// --------------------------------------------
push();
rotateX(TWO_PI*(.25));
for (i=1;i<=12;i++) {
push();
if (i==12) {
noStroke();
fill(255,102,0);
} else {
noStroke();
fill(0,0,0,75);
}
rotateZ(TWO_PI*((i)*HOUR_INC));
if (i<10) {/* ads a zero*/
text("0"+i, -5, -145);
} else {
text(""+i, -5, -145);
}
//rect(0,145,4,10);
pop();
}
pop();

// --------------------------------------------
// digital marks colon symbols
// --------------------------------------------
push();
translate(cos(2*TWO_PI*radian_percentage)*7+7,0);
rotateX(TWO_PI*(radian_percentage));
text(":", 0, 0);
pop();
push();
translate(cos(2*TWO_PI*radian_percentage)*-7+2,0);
rotateX(TWO_PI*(radian_percentage));
text(":", 0, 0);
pop();
push();

// --------------------------------------------
// second
// --------------------------------------------
current_sec = second();
radius = 120;
translate(cos(2*TWO_PI*radian_percentage)*10+10,0) ;
rotateY(TWO_PI*(((45)+current_sec)*SECOND_INC)*-1);

// draw shaded circle
noStroke();

// draw numbers
for (i=0; i<=59;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+current_sec)*SECOND_INC)*-1);
translate(radius,0);

rotateZ(TWO_PI*(((30-i)+current_sec)*SECOND_INC));
rotateY(TWO_PI*(((45)+current_sec)*SECOND_INC));
rotateX(TWO_PI*(radian_percentage));

if (i==current_sec) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}
if (i<10) {/* ads a zero*/
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}

pop();

// --------------------------------------------
// minute
// --------------------------------------------
current_min = minute() + (second()*SECOND_INC);
radius = 100;
push();
translate(0,0);
rotateY(TWO_PI*(((45)+current_min)*MINUTE_INC)*-1);

// draw shaded circle
noStroke();

// draw numbers
for (i=0; i<=59;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((30-i)+int(current_min))*MINUTE_INC)*-1);
translate(radius,0);

rotateZ(TWO_PI*(((30-i)+int(current_min))*MINUTE_INC));
rotateY(TWO_PI*(((45)+current_min)*MINUTE_INC));
rotateX(TWO_PI*(radian_percentage));

if (i==int(current_min)) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}

if (i<10) {/* ads a zero*/
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}
pop();

// --------------------------------------------
// hour
// --------------------------------------------
current_hr = hour()%12 + (minute()*MINUTE_INC);
radius = 40;
push();
translate(cos(2*TWO_PI*radian_percentage)*-10-10,0);
rotateY(TWO_PI*(((9)+current_hr)*HOUR_INC)*-1);

// draw shaded circle
noStroke();

// draw numbers
for (i=0; i<=11;i++) {
push();
translate(radius,0);
rotateZ(TWO_PI*(((6-i)+int(current_hr))*HOUR_INC)*-1);
translate(radius,0);

rotateZ(TWO_PI*(((6-i)+int(current_hr))*HOUR_INC));
rotateY(TWO_PI*(((9)+current_hr)*HOUR_INC));
rotateX(TWO_PI*(radian_percentage));

if (i==int(current_hr)) {/* highlights current time*/
fill(255,102,0);
} else {
fill(0,0,0,50);
}

if (i==0) {/* ads a zero*/
text("12", 0, 0);
} else if (i<10) {
text("0"+i, 0, 0);
} else {
text(""+i, 0, 0);
}
pop();
}
pop();
// ************************************************** **********************
// mouse press initializer
// ************************************************** **********************
if (mouseStatus == true && priorMouseStatus == false) {
priorMouseStatus = true;

// ************************************************** **********************
// mouse press looper
// ************************************************** **********************
} else if (mouseStatus == true && priorMouseStatus == true) {
priorMouseStatus = true;

// ************************************************** **********************
// mouse release initializer
// ************************************************** **********************
} else if (mouseStatus == false && priorMouseStatus == true) {
priorMouseStatus = false;

// ************************************************** **********************
// mouse release looper
// ************************************************** **********************
} else if (mouseStatus == false && priorMouseStatus == false) {
priorMouseStatus = false;
}




}

View Replies !    View Related
Adding Code To Existing Code
I've been after an answer for this problem for some time!

I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!

I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.

How would this be possible? Can I add some coding to the existing code thats placed on the movie?

PLEASE PLEASE HELP IF YOU CAN!

View Replies !    View Related
Adding Code To Existing Code
I've been after an answer for this problem for some time!

I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!

I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.

How would this be possible? Can I add some coding to the existing code thats placed on the movie?

PLEASE PLEASE HELP IF YOU CAN!

View Replies !    View Related
Adding Code To Existing Code
I've been after an answer for this problem for some time!

I have a 2-layerd movie which consists of a roll-over script. When the cursor goes over my movie it loads the 2nd layer. Very simple!

I would like a passage of text to appear also, in a seperate area of the frame, when the cursor rolls over the same movie.

How would this be possible? Can I add some coding to the existing code thats placed on the movie?

PLEASE PLEASE HELP IF YOU CAN!

View Replies !    View Related
[AS3] Run Code End Of Movie W/o Timeline Code?
Super noob question on AS3. I'm told that I'm to avoid putting any code in the timeline and use classes instead. I have a simple logo running in the beginning it has no timeline code. How do I make it so that it will call a function when the movieclip is finished playing?

Thanks!

View Replies !    View Related
How To Convert Java Code To As3 Code
package ConvertNumberIntoWords;

class EnglishDecimalFormat {
private static final String[] majorNames = {
"",
" thousand",
" million",
" billion",
" trillion",
" quadrillion",
" quintillion"
};

private static final String[] tensNames = {
"",
" ten",
" twenty",
" thirty",
" fourty",
" fifty",
" sixty",
" seventy",
" eighty",
" ninety"
};

private static final String[] numNames = {
"",
" one",
" two",
" three",
" four",
" five",
" six",
" seven",
" eight",
" nine",
" ten",
" eleven",
" twelve",
" thirteen",
" fourteen",
" fifteen",
" sixteen",
" seventeen",
" eighteen",
" nineteen"
};

private String convertLessThanOneThousand(int number) {
String soFar;

if (number % 100 < 20){
soFar = numNames[number % 100];
number /= 100;
}
else {
soFar = numNames[number % 10];
number /= 10;

soFar = tensNames[number % 10] + soFar;
number /= 10;
}
if (number == 0) return soFar;
return numNames[number] + " hundred" + soFar;
}

public String convert(int number) {
/* special case */
if (number == 0) { return "zero"; }

String prefix = "";

if (number < 0) {
number = -number;
prefix = "negative";
}

String soFar = "";
int place = 0;

do {
int n = number % 1000;
if (n != 0){
String s = convertLessThanOneThousand(n);
soFar = s + majorNames[place] + soFar;
}
place++;
number /= 1000;
} while (number > 0);

return (prefix + soFar).trim();
}

public static void main(String[] args) {
EnglishDecimalFormat f = new EnglishDecimalFormat();
System.out.println("*** " + f.convert(0));
System.out.println("*** " + f.convert(17708));
System.out.println("*** " + f.convert(16));
System.out.println("*** " + f.convert(100));
System.out.println("*** " + f.convert(118));
System.out.println("*** " + f.convert(200));
System.out.println("*** " + f.convert(219));
System.out.println("*** " + f.convert(800));
System.out.println("*** " + f.convert(801));
System.out.println("*** " + f.convert(1316));
System.out.println("*** " + f.convert(1000000));
System.out.println("*** " + f.convert(2000000));
System.out.println("*** " + f.convert(3000200));
System.out.println("*** " + f.convert(700000));
System.out.println("*** " + f.convert(5960809));
System.out.println("*** " + f.convert(123456789));
System.out.println("*** " + f.convert(-45));
System.out.println("*** " + f.convert(99565789));
// (99565789)


/*
*** zero
*** seventeen thousand seven hundred eight
*** sixteen
*** one hundred
*** one hundred eighteen
*** two hundred
*** two hundred nineteen
*** eight hundred
*** eight hundred one
*** one thousand three hundred sixteen
*** one million
*** two million
*** three million two hundred
*** seven hundred thousand
*** five million nine hundred sixty thousand eight hundred nine
*** one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine
*** negative fourty five
*** ninety nine million five hundred sixty five thousand seven hundred eighty nine

*/
}
}

View Replies !    View Related
Where Should I Place The Preloader Code In This Code..
hi Users,

I am working on a Flash Project in which I have to display a Calendar highlights the dates which have events. Now before loading the Calendar I am calling all the info from a PHP file and then storing it in an array and the using the info for highlighting the days of the events. Now as the info is getting big and big the Calendar is taking sometime to load. I want to place a preloader so that it shows that the Calendar is getting the info. The problem is that I dunno where to place the preloader code. Here is my code where I am getting the info from PHP files:


ActionScript Code:
tellTarget (_root) {
    cal.stop();
    eventDates = new LoadVars();
    eventDates.load("getEvents.php");
        eventDates.onData = function(values) {
        if (values == undefined) {
            eventDates.load("getEvents.php");
        } else {
            checkPlay();
            _root.eventsCollection = new Array();
            _root.eventsCollection = values.split("~");
        }
    };
    //
    recursiveEvents = new LoadVars();
    recursiveEvents.load("getEvents1.php");
    recursiveEvents.onData = function(values) {
        if (values == undefined) {
            recursiveEvents.load("getEvents1.php");
        } else {
            checkPlay();
            _root.recEventsCollection = new Array();
            _root.recEventsCollection = values.split("~");
        }
    };
}
i = 0;
function checkPlay() {
    i++;
    if (i == 2) {
        play();
    }
}

Now I would like to know where should I put the preloader code. Need help. The above code is in a MovieClip which is placed on the main stage.

Regards,
Xeeschan

View Replies !    View Related
Help Please With Code Animated Rollover Code
I am trying to make a tutorial i got from http://www.were-here.com/content/tem...d=679&zoneid=7 work and i have done everything but the code didn't work. I have rewrote it and it also doesn't work. Could someone please take a look at it or tell me where I can go to get a better tutorial that does the same thing.

on (rollOver)
if (_currentframe=1)
gotoAndPlay(2);
else if (_currentframe=20)
stop
else
gotoAndPlay (39-_currentframe)
end if}
end on

on (rollOut)
if (_currentframe=20)
gotoAndPlay (21)
else
gotoAndPlay (39-_currentframe)
end if
end on

View Replies !    View Related
Code To Long Any Other Way To Write This Code
i've been reading / learning actionscript 3 and i am making some simple practice .. but its too long any other way i can write this code it works fine but its too long.. thanks


Code:
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.net.*;
import flash.events.Event;
import flash.display.StageScaleMode;
import flash.display.StageAlign;

public class Test extends Sprite
{
//private
private var navStyle:StyleSheet;

//NAV CONTAINER
private var navContainer:Sprite;

//HOME
private var home:Sprite;
private var homeText:TextField;

//COMPANY
private var company:Sprite;
private var companyText:TextField;

//SERVICES
private var services:Sprite;
private var servicesText:TextField;

//CONTACT
private var contact:Sprite;
private var contactText:TextField;

public function Test() {
init();
}
public function init():void {
loadStyleSheet();
initStage();
}
private function loadStyleSheet():void
{
var styleLoader:URLLoader = new URLLoader();
styleLoader.addEventListener(Event.COMPLETE , completeListener);
styleLoader.load(new URLRequest("css/test.css"));
}
private function completeListener (e:Event):void {
var navStyle:StyleSheet = new StyleSheet();
navStyle.parseCSS(e.target.data);

navContainer = new Sprite();

// HOME
home = new Sprite();
homeText = new TextField();

homeText.selectable = false;
homeText.antiAliasType = AntiAliasType.ADVANCED;
homeText.autoSize = TextFieldAutoSize.LEFT;
homeText.styleSheet = navStyle;
homeText.htmlText="<p class='navigation'><b>HOME</b></p>";
home.addChild(homeText);
addChild(home);

// COMPANY
company = new Sprite();
companyText = new TextField();

companyText.selectable = false;
companyText.antiAliasType = AntiAliasType.ADVANCED;
companyText.autoSize = TextFieldAutoSize.LEFT;
companyText.styleSheet = navStyle;
companyText.htmlText="<p class='navigation'><b>COMPANY</b></p>";
company.addChild(companyText);
addChild(company);

// SERVICES
services = new Sprite();
servicesText = new TextField();

servicesText.selectable = false;
servicesText.antiAliasType = AntiAliasType.ADVANCED;
servicesText.autoSize = TextFieldAutoSize.LEFT;
servicesText.styleSheet = navStyle;
servicesText.htmlText="<p class='navigation'><b>SERVICES</b></p>";
services.addChild(servicesText);
addChild(services);

// CONTACT
contact = new Sprite();
contactText = new TextField();

contactText.selectable = false;
contactText.antiAliasType = AntiAliasType.ADVANCED;
contactText.autoSize = TextFieldAutoSize.LEFT;
contactText.styleSheet = navStyle;
contactText.htmlText="<p class='navigation'><b>CONTACT</b></p>";
contact.addChild(contactText);
addChild(contact);

home.x = 0;
company.x = home.width + 20;
services.x = company.x + company.width + 20;
contact.x = services.x + services.width + 20;
navContainer.addChild(home);
navContainer.addChild(company);
navContainer.addChild(services);
navContainer.addChild(contact);
addChild(navContainer);

}

private function textFormat (navText:TextField, menuLabel:String):void {
navText = new TextField();
navText.selectable = false;
navText.embedFonts = true;
navText.antiAliasType =AntiAliasType.ADVANCED;
navText.type = TextFieldType.DYNAMIC;
navText.autoSize = TextFieldAutoSize.LEFT;
navText.styleSheet = navStyle;
navText.htmlText ="<p class='navigation'><b> "+menuLabel+" </b></p>";
}
private function initStage():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
}

}
}

View Replies !    View Related
Help Me With This Code(small Code) Mx
I need help with this script.

I dont find the way to make it display the correct month.
I know that flash does count from 0 to 11 for the months but i cant find out how to make it display 10 for october.

calendarday = today.getDate() + "/"+ today.getMonth() + "/" + today.getFullYear();

Btw is someone knows how to make the real day names and months show up instaed of the numbers it would be nice if you give me a hand on it

Thanks a lot

View Replies !    View Related
Code W/in Code Problem
hello, all, have an AS question:

i have a movie clip that, upon rollover, plays the movie clip. upon rollout, the movie clip plays in reverse. now, the last frame in this movie clip has two additional movie clips, so if you can envision:

test
|
|
|
-----> test_02
|
|
-----> test_03

both test_02 and _03 have animation, such that, upon rollover, the movie clip plays and upon rollout, the movie clip plays in reverse. the code for all three are, in fact, the same.

i have tested the code, and all of them work just fine. however, when i place test_02 and test_03 in the test movie clip, their animation (rollover, rollout) does not work.


here is the code on the movie clip (it is the same code for test, test_02, and test_03, but the variable names are just different)

on(rollOver){
_root.over_test = true;
}
on(rollOut){
_root.over_test = false;
}

here is the code on the actions layer:

n_test.onEnterFrame = function(){
if(_root.over_test){
this.nextFrame();
}else{
this.prevFrame();
}
}

any help is greatly appreciated.

View Replies !    View Related
Capturing Key Code. Which Code Is Better
Hi!
I want to check whethe user has pressed the TAB key or not.I can write the code in two ways.I want to know which one is better?
1)on Movieclip
onClipEvent (keyDown) {
kp = Key.getCode();
if (kp == 9) {
trace("tab is pressed");
}
}

2)on Button
on(keyPress "<Tab>"){
trace("tab is pressed");
}

Which method is better. Is there any advantages/drawbacks of using above code?
Thank You.

Mahesh K.

View Replies !    View Related
Do I Need To Use Less Code Or Can I Delete This Code?
I am using the code below on each MC (16 in all) so that each MC will appear in the swf at 90% of original size. These will be used for thumbnails for larger pics in the site.

My 2 part question is this - (1) is there a different way to do the same effect that uses less code? (2) if I uses the code the way it is, is there a way to delete the code once the thumbnails have all appeared on the stage?

code:

onClipEvent( EnterFrame ){
var speed = 10
var viscosity = 1.3
xscale = 75
yscale =75
difference = xscale - this._xscale
xvelocity = (xvelocity + difference / speed) / viscosity
this._xscale = this._xscale + xvelocity
difference = yscale - this._yscale
xvelocity = (xvelocity + difference / speed) / viscosity
this._yscale = this._yscale + xvelocity
}

View Replies !    View Related
Can Anyone Tanslate AS2 Code Into AS3 Code? Willing To Pay For Help
Hi, I am having a world of errors and trouble trying to translate some code from as2 to as3. Its pretty complex. can anyone help? Willing to pay you something.

View Replies !    View Related
Convert AS1 Code To AS3 Code
Hi All;
I have a lot of code in AS1 and which I have to vonvert to AS3.There are 4000 files so it is difficult to write all the code from scratch.

So, can anybody suggest me the esiest way to convert these code from AS1 to AS3.

Please Help Me..............
Thanks in Advance.........

View Replies !    View Related
Can AS1 Code Call AS3 Code?
I was wondering if there was any way for AS1 code to call AS3 code.

I need to write a server extension for SmartFox Pro. I just found out that the only version of action script that SmartFox sever extensions can be written in is AS1. However, I have a bunch of code already written in AS3 that I need to use. I have all of the source for the AS3 code.

Is there a way for me to use my existing code, or am I out of luck?

Thanks in advance
John Lawrie

View Replies !    View Related
AS3 - Regexp For [code] ... [/code]
Hi all!

How would one write an regexp that detects the occurances of [c0de] ... [/c0de] in a textstring? for example:

Lorem ipsum [c0de]dolor sit amet, consectetur adipiscing elit.[/c0de] Curabitur pulvinar nisl eget turpis. Aenean nulla. Integer bibendum sapien sit amet lorem. Integer vulputate enim ut diam. Fusce non sapien. Vivamus venenatis. [c0de]Nulla facilisi.[/c0de] Mauris tincidunt turpis at lorem. Nulla tellus. Suspendisse vitae nisl ac diam consectetur tempus.

View Replies !    View Related
Can Anyone Convert This Actionscript 2.0 Code To Actionscript 3.0 Code ?
Hi, I'm a graphic designer and I've used this system since the last two years. I would like to convert it on to actionscript 3.0 but I am not a programmer. Can someone help me please? Thank you!

on(rollOver){
txt.gotoAndPlay("entrada")
}
on(rollOut){
txt.gotoAndPlay("salida")
}

on (release) {
_parent.navegate("clip01")

if (_parent.anterior != "occitane") {
_parent[_parent.anterior].gotoAndPlay("salida");
}
_parent.anterior = "occitane";
_root.navigate("occitane");
}

================================================== ===

function navigate(destino) {
if (firstime != false) {
_root.currentSection = destino;
_root.gotoAndPlay("salida");
firstime = false;
} else {
_root.currentSection = destino;
_root.contenedor.gotoAndPlay("salida");
}
}

================================================== ===

salida = "salida00"
function navegate(destino){
this.destino=destino
this.gotoAndPlay(salida)
salida = "salida" + destino
//salida = "salida" add destino
}
stop()

================================================== ===

fscommand("showmenu", "false");
fscommand("allowscale", "false");

Stage.scaleMode = "noscale";
//-----------------------
var StageWidth:Number = 1000;
var StageHeight:Number = 546;
function escalaFondo()
{
if (Stage.width > Stage.height) {
fondo._width = Stage.width;
fondo._yscale = fondo._xscale;
} else {
fondo._height = Stage.height;
fondo._xscale = fondo._yscale;
}

fondo._x = (StageWidth - fondo._width) / 2;
fondo._y = (StageHeight - fondo._height) / 2;
}
//-----------------------
Stage.addListener(this);
this.onResize = escalaFondo;
escalaFondo();
//-----------------------

View Replies !    View Related
Converting Flash 8 Code To Flash 6 Code
Edit: Just gonna stick with Flash 8 hehe thx anyway

View Replies !    View Related
Help With Code
I am trying to set the RGB of a bunch of movie clips with a variable but it is not working. Can someone help? Here is the code.


In frame 1
clip1.setRGB(color1)
clip2.setRGB(color2)
clip3.setRGB(color3)
clip4.setRGB(color4)
clip5.setRGB(color5)
clip6.setRGB(color6)


Code on the Movie Clips
onClipEvent (load) {
clip1.setRGB(color1);
}
onClipEvent (load) {
clip1.setRGB(color2);
}
onClipEvent (load) {
clip1.setRGB(color3);
}
onClipEvent (load) {
clip1.setRGB(color4);
}
onClipEvent (load) {
clip1.setRGB(color5);
}

onClipEvent (load) {
clip1.setRGB(color6);
}

View Replies !    View Related
Look At This Code
Can someone briefly explane how I can change this code the show an MC instead of the dynamic copy ie, sec, row and col?

//onClipEvent (load) {
var go = 0;
carr = new Array();
rarr = new Array();
this.sq._visible = 0;
var initx = this.sq._x;
var inity = this.sq._y;
var bound = this.sq._width+15;
var num_rows = 5;
var num_cols = 5;
var dep = 0;
var ratio = .3;
var friction = .4;
// -------------------------------
function createMatrix () {
for (row=0; row<num_rows; row++) {
this.rarr[row] = inity+(bound*row);
for (col=0; col<num_cols; col++) {
this.carr[col] = initx+(bound*col);
this.sq.duplicateMovieClip('box'+dep, dep);
this['box'+dep]._x = this.carr[col];
this['box'+dep]._y = this.rarr[row];
this['box'+dep].section = 'section '+dep+' row '+row+' / col '+col;
myColor = new Color(this['box'+dep].bg);
var newcol = (((_root.CmYarr[row] << 8)+_root.CmXarr[col]) << 8);
myColor.setRGB(newcol);
dep++;
}
}
}
}
onClipEvent (enterFrame) {
if (go == 1) {
markx = this.carr[myCol];
marky = this.rarr[myRow];
markx = -markx;
marky = -marky;
// trace('markx='+markx+'---marky='+marky);
speedx = ((markx-_x)*ratio)+(speedx*friction);
speedy = ((marky-_y)*ratio)+(speedy*friction);
this._x += speedx;
this._y += speedy;
}
updateAfterEvent();
}//

m

View Replies !    View Related
Code Help
Hi Flash Freaks,
I love ya!
First: I am trying to open a browser window outside of the swf but from the swf to show the viewer a particular image that the viewer himself or herself selected by pressing a button in the flash swf.
I want the window to open to the exact size of the image with no tool bars or any other stuff around it just the normal frame edges.
I can open the image directly to a window now. All I want to do is size it to the image and knockoff the exterior browser program crap.
Sounds simple... But it's a tuffy, do I use java or an action script?
Please contact me either email or through this board if you've done this or know how to.
Thank you in advance.
Joseph Hahn
CyberHues, inc.
joe@cyberhues.com

View Replies !    View Related
CODE CODE CODE
Hey guys, I need to know how to just have a timer on my movie. It's for a music movie, and I was wondering if I could have the time like 00:34:50 or something on the screen actually reading the time from the movie. This has to be possible.

thanks a lot

View Replies !    View Related
Code Please
thanx andrews ,but can you actually show me how to do it i mean can u show mw the code :i have not used arrays before just variables.so please show me what actions to out on buttons and how to check the arrays?
thanx!

View Replies !    View Related
To Code Or Not To Code...
Hi

What are peoples' views on how best to learn coding and programming?

I am a reasonably competant Flash designer, but I need to progress to the next level. I can build simple iterative routines and such like with ActionScript, but I want to move to a 'real' programming level- object dynamics, interactivity etc.

So, if I am an designer and I am able to understand the scripting basics, what is the best way to go about learning the nitty gritty of programming?

I am a trained mechanical engineer so I have pretty good learning skills (I HOPE!).

any thoughts???

jb

View Replies !    View Related
Help With This Bit Of Code Please?
I have a bunch of buttons.. when i mouseover a button, i want text to fade in.. when i mouseoff, i want the text to fade out... if the person clicks on the button, i want the text to stick even when they mouseoff or mouseover it again... here's my code so far..

on (rollOver) {
_root.fes1.state=1;
_root.fes1.gotoAndPlay(2);
}
on (rollOut) {
if (_root.fes1.state==1) {
_root.fes1.gotoAndPlay(9);
}
}
on (press) {
_root.fes1.state=0;
}

this works fine.. i click the button, the text sticks when i mouseoff.. however if i mouseover it again, the fading text in animation plays again, and i dont want it to play, i just want the text to stay there.. also.. if i have 5 buttons or whatever.. how could i make it so that when i click on one, it makes all the others reset to state==1 (so that they're greyed out and not white (clicked on).. thanks

adam

View Replies !    View Related
Please Help With My Code
I am trying to find out the browser and then do the action acoording can you help please.
if (app.indexOf('Microsoft') != -1) {
loadMovieNum ("menu_system.swf", 1);
} else if (app.indexOf('Netscape') != -1) {
gotoAndPlay (2);
}
Or if you have a betterr code let me know. Thanks.

View Replies !    View Related
Were Do I Put This Code
i was given this code to link from my movie to a html page but what do i have to do to make it link wat does on release mean i need to make it go when someone clicks goto my homepage please help.....

on (release) {
getURL ("http://members.tripod.com/sheepy2k/");
}

View Replies !    View Related
Code Help
n = 0;
while (n < 2) {
if ("fil"+n._x eq 0) {
setProperty ("fil"+n, _y, "fil"+n._y+1);
}
if ("fil"+n._y eq 80) {
setProperty ("fil"+n, _x, "fil"+n._x+1);
}
if ("fil"+n._y eq -80) {
setProperty ("fil" + n, _x, "fil" + n._x-1);
}
n = n+1;
}


This code wont work... What is wrong with it?

View Replies !    View Related
What Code?
Can anyone tell me what the code to imbed swf movies into html is. I have a nav bar made in swish I wish to use.

Also I want to include a chat room and message board in my website, what code would I use; php, or what??

thanx in advance

Synopsis the "flash daddy"

View Replies !    View Related
Code
on (release) {
getURL ("http://www.lighthousecov.org/main.html");
}
That's the code. i dont know what you can do to help me with it im new to action scripting so i dont know what to do if you can help me thanks.

View Replies !    View Related
What Code Do I Use?
I need help with processing my flash movie. I have an event sound but before that i have a title page with a button that says play. Since it is an event sound, The whole thing has to download before i can push play, but I'm having trouble locating the right actionscript to prevent it from going to frame 3 (which is the title page)until the sound (or whole movie) has downloaded. What should I do. It'll be a great help.

View Replies !    View Related
Please Help Me Fix My Code
Please help!! I want to use my own code!

[]
//first we make the movement function
function snowFall(){
this._x+= Math.random() * 1; //snow drift
this._y += Math.random() * 3; //snow fall
}

//now we make the first clip inherit!
snowFlakeClip.prototype.snowFall();

//Now we make it snow!
for (var i=1; i++){
duplicateMovieClip("_root.snowFlakeClip", "flake+i", "i");
_root.flake+i._x += Math.floor(Math.random) * 500);
_root.flake+i._y -= 10;
}

now = getTimer();
if(now > 10000){
unloadMovie(_root.flake+[i+50]);
[/code]

View Replies !    View Related
Need PHP <-> Help (PHP Code)
Hi all,

I need some help with a PHP issue. I have a movie that allows users to create a list of candidates (like a shopping basket). This then needs to be passed to PHP. Currently it works OK, but the number of passed values is going to vary. At the moment, I am passing the data to PHP, then back into a flash text box to see if it works:


Code:
<?
// PHP script
// receives from Flash
$returnText = $candidate0 . "
" . $candidate1 . "
" . $candidate2 . "
" . $candidate3 . "
" . $candidate4;

// returns to Flash
print "&results=" . urlencode($returnText);

?>


Like I say, this is fine, as long as there are only 5 candidates. I know that if I send a PHP script candidate0, candidate1, candidate2 etc up to candidate20, it will be able to access them, but how will the script know how many it is getting? I wrote this to attempt it (similar to using eval() to dynamically create a var):


Code:
<?

// PHP script
// receives from Flash
// $numberOfCandidates is sent by Flash
$count = 0;
$candidateWord = "candidate";

do {
$returnText . = $$actorWord . $count;
$count++;
} while ($count < $numberOfCandidates);


// returns to Flash
print "&results=" . urlencode($returnText);

?>


Can anyone help?

Leon
[Edited by lochwinnoch on 02-13-2002 at 01:35 PM]

View Replies !    View Related
Key Get Code
Hi i just wondering if any of you know why any code with the key object dont work properly untill you dont press the mouse...i mean if... i place a code to change alpha of one movie if the user use the numer "1" in the keyboard. .....nothing happen till you click on the screen with the mouse...then all works.....suggestions?=P
Tx in adavnce

View Replies !    View Related
What Does This Code Mean?
Hi,
I've seen things like this before from files I've downloaded, and I was just wondering what it means.
I'm fine will all of the script except for the "/../scroller" part. What does the "/../" mean?

setProperty ("../../../scrollbar", _visible, true);

Cheers

View Replies !    View Related
Help On Code
Hi all
I found this script at actionscript.org.
could someone please explain me....what does it mean and wher do I need to insert instance name of clip?
on (release) {
for (z in _root) {
if (typeof (_root[z]) == "movieclip") {
_root[z].removeMovieClip();
}
}
}
thanks

View Replies !    View Related
Can Someone Look At This Code......please
Hi Guys, i am trying to build my first form and i have put this code into my submit button:


on (release) {
if (txtName ne "" and txtCompany ne "" and txtPosition ne "" and txtFrom ne "" and txtMessage ne "") {
loadVariables ("cdontsmail.asp", 0, vars = POST);
}gotoAndPlay ("valid")
Else
gotoAndPlay ("invalid")
End If;
End On;
}

but i keep getting these errors:

Scene=Scene 1, Layer=content, Frame=1: Line 3: Method name must be GET or POST
loadVariables ("cdontsmail.asp", 0, vars = POST);

Scene=Scene 1, Layer=content, Frame=1: Line 7: ';' expected
End If;

Scene=Scene 1, Layer=content, Frame=1: Line 8: ';' expected
End On;

as far as i can tell the errors are incorrect but i am no whiz at programming!! if anyone could put me onto the right trail i would be grat3ful.

deadpan

View Replies !    View Related
Using This Code...
I am using this code:

x is set in maintimeline to 1;

onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.swapDepths(_root:x);
_root:x++;
startDrag (this);
}
}
onClipEvent (mouseUp) {
stopDrag ();
}

on multiple MC's that when clicked on are draggable and come to the front. This works. The problem is that when the MC's are overlapping one another, sometimes when clicking on the part where they overlap brings the one behind the one I actually am clicking up a depth.

Any help would be gratly appreciated.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved