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




Double Question About This Code (appended) LoadMovie And Moving Through An Index Var



Hi,

Question 1 - Why is the jpeg loading in the lo_container mc only after the jpeg in the container mc is loaded? Doesn't seem like it should. I want the lo jpeg to load right away (it is very lo rez) the preloader run over top then when the second jpeg is loaded fadeOut the lo jpeg. Right now the lo jpeg is not viewable as the preloader is going

Question 2 - I'm trying to set up next and previous buttons which would modify the index var. My code is definitely wrong right now....

all Frame 1

on an actions layer........

ActionScript Code:
createEmptyMovieClip("lo_container", 2);lo_container._x = 0;lo_container._y = 168.1;createEmptyMovieClip("container", 1);container._x = 0;container._y = 168.1;//variablesvar series = "p";var index = 1;var totalFiles = 22;// start the showloadMovie("../images/"+series+"/lo_image"+index+".jpg", "lo_container");loadMovie("../images/"+series+"/image"+index+".jpg", "container");fadeIn = function () {    if (lo_container._alpha<=100) {        lo_container._alpha -= 10;    }};

on a preloader layer....

ActionScript Code:
stop();container._visible = false;this.onEnterFrame = function() {    var l = container.getBytesLoaded();    var t = container.getBytesTotal();    var getPercent = l/t;    loadText = "Photo loading... "+Math.round(getPercent*100)+"%";    if (l > 0 && l >= t) {        container._visible = 1;        loadText = "";        fadeIn();    }};

on each buttone....

ActionScript Code:
next.onPress = function() {    if (index>=1) {        index++;    }};

[EDIT by kode]Please use the ActionScript tag [AS][/AS] to show your code.[/EDIT]



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX
Posted on: 09-22-2003, 06:52 PM


View Complete Forum Thread with Replies

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

Index Xml Target.name.length And Double-digits Issue
I have an issue, I have about 25 mc's that are named carBtn1 through carBtn25 - the problem is when I index my array - its only taking the first number from the end of the carBtn, so carBtn1 is seen as the same as carBtn10. I tried taking the last 2 digits off which works for 2 digit numbers - but everything below 10 isnt working anymore. Im not sure what to do to get it working....

Here is my code:


Code:
// variables
var popInfo:popMc;


// load xml
var xml:XML = new XML();
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("data/cities.xml"));
loader.addEventListener(Event.COMPLETE,
function(evt:Event):void {
xml = XML(evt.target.data);
//trace(xml.city[0].@weburl.toString());
var url:URLRequest = new URLRequest(xml.city[0].@weburl.toString());

}
);

// event listeners
stage.addEventListener(MouseEvent.CLICK, onClickStageRemove);

for (var j:int = 0; j < 11; j++)
{
getChildByName("carBtn" + j).addEventListener(MouseEvent.CLICK, onClickLoadData);
getChildByName("carBtn" + j).addEventListener(MouseEvent.MOUSE_OVER, onCarHover);
getChildByName("carBtn" + j).addEventListener(MouseEvent.MOUSE_OUT, onCarOut);
}



// button mode
buttonMode = true;

// functions
function onCarHover(event:MouseEvent):void
{
event.target.gotoAndPlay(11);

}

function onCarOut(event:MouseEvent):void
{
event.target.gotoAndPlay(10);
}


function onClickLoadData(event:MouseEvent):void
{
popInfo = new popMc();
popInfo.x = 100;
popInfo.y = 50;
addChild(popInfo);
popInfo.closeBtn.addEventListener(MouseEvent.CLICK , onClickRemove);
popInfo.nyopBtn.addEventListener(MouseEvent.CLICK, onClickNYOP);
//better approach would be add separate classFile to haldle some popInfo's events
//such removing on stageClick in that file u could add those functions:
var index:Number=event.target.name.slice(event.target.name.length-1);
popInfo.carsizeText.text = xml.city[index].bidlist.carsize.descendants().toXMLString();
popInfo.priceText.text = xml.city[index].bidlist.price.descendants().toXMLString();
popInfo.savingsText.text = xml.city[index].bidlist.savings.descendants().toXMLString();
popInfo.stateText.text = xml.city[index].@name.toString();
addChild(popInfo);
}


function onClickRemove(event:MouseEvent):void
{
popInfo.closeBtn.removeEventListener(MouseEvent.CLICK, onClickRemove);
popInfo.nyopBtn.removeEventListener(MouseEvent.CLICK, onClickNYOP);
removeChild(popInfo);
}

function onClickStageRemove(event:MouseEvent):void
{
if(event.eventPhase == EventPhase.AT_TARGET) {
removeChild(popInfo);
}
}

function onClickNYOP(event:MouseEvent):void
{
//navigateToURL(url, "_blank");
// navigateToURL(urlNY, "_blank"); //trying to get this variable to work
ExternalInterface.call("selectNY");

}

// set button mode here

Index Xml Target.name.length And Double-digits Issue
I have an issue, I have about 25 mc's that are named carBtn1 through carBtn25 - the problem is when I index my array - its only taking the first number from the end of the carBtn, so carBtn1 is seen as the same as carBtn10. I tried taking the last 2 digits off which works for 2 digit numbers - but everything below 10 isnt working anymore. Im not sure what to do to get it working....

Here is my code:

Code:
// variables
var popInfo:popMc;


// load xml
var xml:XML = new XML();
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("data/cities.xml"));
loader.addEventListener(Event.COMPLETE,
function(evt:Event):void {
xml = XML(evt.target.data);
//trace(xml.city[0].@weburl.toString());
var url:URLRequest = new URLRequest(xml.city[0].@weburl.toString());

}
);

// event listeners
stage.addEventListener(MouseEvent.CLICK, onClickStageRemove);

for (var j:int = 0; j < 11; j++)
{
getChildByName("carBtn" + j).addEventListener(MouseEvent.CLICK, onClickLoadData);
getChildByName("carBtn" + j).addEventListener(MouseEvent.MOUSE_OVER, onCarHover);
getChildByName("carBtn" + j).addEventListener(MouseEvent.MOUSE_OUT, onCarOut);
}



// button mode
buttonMode = true;

// functions
function onCarHover(event:MouseEvent):void
{
event.target.gotoAndPlay(11);

}

function onCarOut(event:MouseEvent):void
{
event.target.gotoAndPlay(10);
}


function onClickLoadData(event:MouseEvent):void
{
popInfo = new popMc();
popInfo.x = 100;
popInfo.y = 50;
addChild(popInfo);
popInfo.closeBtn.addEventListener(MouseEvent.CLICK , onClickRemove);
popInfo.nyopBtn.addEventListener(MouseEvent.CLICK, onClickNYOP);
//better approach would be add separate classFile to haldle some popInfo's events
//such removing on stageClick in that file u could add those functions:
var index:Number=event.target.name.slice(event.target.name.length-1);
popInfo.carsizeText.text = xml.city[index].bidlist.carsize.descendants().toXMLString();
popInfo.priceText.text = xml.city[index].bidlist.price.descendants().toXMLString();
popInfo.savingsText.text = xml.city[index].bidlist.savings.descendants().toXMLString();
popInfo.stateText.text = xml.city[index].@name.toString();
addChild(popInfo);
}


function onClickRemove(event:MouseEvent):void
{
popInfo.closeBtn.removeEventListener(MouseEvent.CLICK, onClickRemove);
popInfo.nyopBtn.removeEventListener(MouseEvent.CLICK, onClickNYOP);
removeChild(popInfo);
}

function onClickStageRemove(event:MouseEvent):void
{
if(event.eventPhase == EventPhase.AT_TARGET) {
removeChild(popInfo);
}
}

function onClickNYOP(event:MouseEvent):void
{
//navigateToURL(url, "_blank");
// navigateToURL(urlNY, "_blank"); //trying to get this variable to work
ExternalInterface.call("selectNY");

}

// set button mode here

Get URL With A Whack Of Appended Variables?
Hi

How do I send a link like this in Flash:

"http://www.siteinprogress.com/newfeature.asp?FeatureID=-1591771072,507590900,-1799380161,749035630,1875053377,192444765,-483080361,-1105251252,1152260162,123593114,1555173022,-384824974,1062609107,1266952809,-1018587734,934375291,-2123264493,-1067141644,-249508554,-1745791662,1754007475,1029638155,-2076686925,-365495683,1809183384,-1859552703,858583171,940598332,-1312684883&inctxt=bcfeaturetxt.inc"

when i try to simply do it by Behaviours > Web > Go to Webpage, and paste the above string into the URL field, I get the following error:

"The Value:
[URL as shown above]
contains characters which are not permitted in a behaviour variable."

How can I do this?

Get URL With A Whack Of Appended Variables?
Hi

How do I send a link like this in Flash:

"http://www.siteinprogress.com/newfeature.asp?FeatureID=-1591771072,507590900,-1799380161,749035630,1875053377,192444765,-483080361,-1105251252,1152260162,123593114,1555173022,-384824974,1062609107,1266952809,-1018587734,934375291,-2123264493,-1067141644,-249508554,-1745791662,1754007475,1029638155,-2076686925,-365495683,1809183384,-1859552703,858583171,940598332,-1312684883&inctxt=bcfeaturetxt.inc"

when i try to simply do it by Behaviours > Web > Go to Webpage, and paste the above string into the URL field, I get the following error:

"The Value:
[URL as shown above]
contains characters which are not permitted in a behaviour variable."

How can I do this?

GetBytesLoaded Etc. From Index.swf Through LoadMovie
Maybe not the best description of this topic ;-)

I´m loading swf:s into my main movie to an empty MC (holder) and would like to have a preloader in my mainmovie to handle the preloading of all swf:s that I load. Using this code in my mainmovie.

[as]

bytes_loaded = holder.Math.round(getBytesLoaded());
bytes_total = holder.Math.round(getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBarH._width = (getPercent*100)*1.5;
this.loadTextH = Math.round(getPercent*100)+"%";
this.loadTotalH = getBytesTotal()/1000;
this.loadSofarH = getBytesLoaded()/1000;

AS]

But this do not work from me :-)

Input Text Getting Mysteriously Appended
Hello,

I have an input text box, that I'm using on a page to send a name into a php script, (which then does a mysql update on a row in a mysql table). Everything works smooth, except that whatever I type into that input text field, a "<br />" gets added to it. does anyone know why this happens? Thanks.

- HELP - Double LoadMovie DOEN'T WORK - HELP -
I have a main swf (call it artists) and from artists a sub movie is loaded (call it Jay_Z). What I'm tryin to do is to have the Jay_Z move load another movie (call it song_samples).

I made the audio files (not actually Jay_Z) in to individual movies for faster loading but flash will not allow me after I load Jay_Z into artists to then load song_samples into Jay_Z (Jay_Z is still viewable in artists).

EG: Artists.swf: inside artists.swf there is a sub move with an instance name "theartists" so theartists.loadMovie("Jay_Z.swf"). -- this is ok. Now in Jay_Z.swf there is a sub movie with an instance name "sample" so sample.loadMove("song_sample") -- this is not ok.

On its own Jay_Z.swf (outside of Artists.swf) will load song_sample.swf perfectly but while inside artists.swf it wont.

How can I get around this... or does anyone know how to bypass this?

Please Help

Double Click Code?
Does anyone have a nice Double Click example?

Deconcept Flash Code + Z Index
My problem lies on http://www.doubledub.net/globalmessenger

I have this nifty flash globe and navigation spheres that should be positioned on layers above. I had the navigation working just peachy until I looked at the site in IE and noticed the activation error on the flash that was solved by including the js code from deconcept. Now the IE error is gone, but the navigation spheres are positioned back below the flash again. Before, I had solved this with the following code:

<param name="wmode" value="transparent" />
<EMBED src="earthglobefinal.swf" quality=best bgcolor=#333333 wmode="transparent" WIDTH="400" etc...

Now I don't know how to edit the java from deconcept to allow a fix for this. Can anyone help? Many thanks...
-kw

Centering And Framing My .swf In My Index.html Code
I’m not familiar with JAVA script and I can’t figure out how to adjust the html “index” file obtained via the publish option in flash cs 3. I want to edit in Dreamweaver the html index file that contains my flash site so that my flash page is framed and centered on the page; it’s also important that the page retains the capabilities of AC_RunActiveContent which I plan on posting to my server. I don’t want users to have to approve the install activeX control every time. I’ve tried variations of code and tried to work through it, but no matter what I do I end up with a quarky outcome. The most common outcome is where the page is requesting to install activeX control despite the presence of my AC_RunActiveContent file and displays within the frame the error message that is meant for users who do not have a Flash Player Installed, yet if you simply accept the ActiveX control request the flash becomes viewable.. not drastically off, but really quarky. Can someone look at my code and make suggestions or better yet indicate for me what the correct code for this situation should look like? .......

I've Posted Some Code (Preloader) -- Please Double-Check
Hello All,

So ... this site again: www.theproblemofnothing.com. Oh man. Sometimes it freezes, sometimes it doesn't. Sometimes it works on IE and not Firefox, sometimes on Firefox and IE. I think I've got it fixed. But I can't rest. I'm not sure. The main movie calls externals SWFs via loadMovie - here's the code from one of the many individual movies:


Code:
#include "lmc_tween.as"
this.stop();
That's on the first frame. Here's the second:


Code:
this.stop();

//--------------------------------
// THE SET UP
//--------------------------------

artwork_mc._alpha = 0;

//--------------------------------
// GO TIME!
//--------------------------------

goAhead = function () {
artwork_mc.tween("_alpha", 100, 1, "easeInOutCubic", 0);
}
goAhead();
Here's the first frame within the preloader bar:


Code:
bar._width = 0;
And the second frame of the preloader bar:


Code:
this.onEnterFrame = function() {
var bt = _parent.getBytesTotal();
var bl = _parent.getBytesLoaded();
var percent = bl/bt;
bar._width = Math.round(percent*91);
if (bt == bl) {
delete this.onEnterFrame;
this.tween("_alpha", 0, 0.5, "easeInOutCubic", 0, themainer);
}
};
function themainer() {
_parent.gotoAndStop("main");
}
//themainer();
stop();
That's about it. The buttons in the main file are just:


Code:
icon_mc_1.onRelease = function(){
container_mc.loadMovie("_art/image_1.swf");
this.tween("_y", 533, 1.5, "easeOutElastic", 0);
OK. That's it. Promise. I think I fixed it by adding the ".this" parameter to some of script in the loader -- I believe the "stop();" was stopping the main movie itself. Hmm. But I'm not sure.

Well, if you've got some free time, please check my code, let me know what you think! <3's for Kirupa. Saved my *** so many times.

Cheers,
Mark(decisionman)

Help With Index HTML Embed Code - Version Detection Etc.
Hi there
Really need some help with the index html page.
Someone redid my code to fix an active x issue but the original version detection/install code was lost so its not got any help for visitors and getting reports of site not working as a result.

Please check
www.thebrightgolfcompany.co.uk

Id be really grateful foir a quick fix with best code to add to index.

Please let me know what you advise to get the site working as well as possible - Thank you!!

Please Help With Code (attachMovie,Array[index],linked Buttons)
Please, please, on my knees, could someone have a glance over this code and offer some answers as to why the buttons are not working.
I am trying to morph to files so as I have the functionability of the buttons and the advantage of fading into two levels to decrease CPU grind.

Thanks (perhaps some knees pads will be in my stocking!)

zipped file attached ((PC) MX 2004)

//Main file


ActionScript Code:
var swfArray = new Array("mixed/1.jpg", "mixed/2.jpg", "mixed/3.jpg")
var totalNumPics:Number = swfArray.length;
var maxDepth = 1000;
var cpicnum = 0;
var xi = 50;
var yi = 20;
var btnWidth = 25;
var currentpic = 0;
var buttonHolder = visible(false)
////////////////////////////////////////////
function loadNextPic() {
    if (_root.cpicnum<_root.totalNumPics) {
        var pic_mcl = new MovieClipLoader();
        var listener:Object = new Object();
        listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
            trace(target+".onLoadProgress with "+bytesLoaded+" bytes of "+bytesTotal);
            _root.percent = int(bytesLoaded*100/bytesTotal);
        };
        listener.onLoadComplete = function(target_mc:MovieClip, httpStatus:Number) {
            _root.percent = "Done!";
            var param = {_x:(_root.xi+_root.cpicnum*_root.btnWidth), _y:_root.yi};
            var temp = _root.attachMovie("btn", "btn"+_root.cpicnum, _root.getNextHighestDepth(), param);
            temp.num = _root.cpicnum+1;
            _root.cpicnum++;
            loadNextPic();
        };
        //
        var target1 = _root.attachMovie("picHolder1", "picHolder1"+cpicnum, 1, {_x:50, _y:50});
        var target2 = _root.attachMovie("picHolder2", "picHolder2"+cpicnum, 2, {_x:50, _y:50});
        pic_mcl.loadClip(swfArray[0], target2);
        pic_mcl.addListener(listener);
        ///////
        target1._alpha = 100;
        target2._alpha = 0;
        activeTarget = target1;
        currentIndex = 0;
        target1.loadMovie(swfArray[0]);
    }
}
onEnterFrame = function () {
    if (obj1._alpha>0) {
        obj1._alpha -= 10;
    }
    if (obj2._alpha<100) {
        obj2._alpha += 10;
    }
   
};
loadNextPic();
this._lockroot = true;

Code on button


ActionScript Code:
this.onRelease=function(){
    if (_root.activeTarget == _root.target1) {
        _root.obj1 = _root.target1;
        _root.obj2 = _root.activeTarget = _root.target2;
    } else {
        _root.obj1 = _root.target2;
        _root.obj2 = _root.activeTarget = _root.target1;
    }
    ///index below is just a test to see if obj2 is in fact loading. Ideally I need for the index to find the current picture number??///
    _root.currentIndex = 6;
   
    //load content into second clip
    _root.obj2.loadMovie(_root.swfArray[6])
}

Why Doesnt This Small Double Click Code Work?
why doesnt this double click code work?
for one click it traces
SINGLE
for a double click it traces
SINGLE
DOUBLE

it should just trace DOUBLE

on(release){
currentTime = getTimer();
if(currentTime<(lastTime+500)){
trace("double");
} else {
lastTime = getTimer();
trace("single");
}
}

***. Arrarys, Finding Index, Loading Called Pic From Found Index
I am fairly new to flash, so thanks for bearing with me - here is my problem -
1. I have a bunch of associated arrays, populated from an xml file.
2. I have a dyn mc that displays thumbs, based on the info from the arrays.
3. if the user clicks on the thumb, I want the on release to trigger (among other things) a function that will find the index of, say, "houseID" so I can then apply that index in loading up a different(big) jpg , and other info pertinent to that thumb.
here is my code for the button:
on (release) {
//carry ID being the variable passed thru "oneHouse" function
CarryID=this.houseID;

trace("houseid"+houseID);
_parent.oneHouse(CarryID)
//"big" being the frame label
_parent.play("big")
}

-----------------------
here is code from a frame -

foundIndex = findByID(CarryID);
if (foundIndex != null) {
/*set dynamic textbox values from Arrays
all this stuff is not set up yet...
txtLocation = houseLocationArray[foundIndex];
txtBed = houseBedArray[foundIndex];
txtBath = houseBathArray[foundIndex];
txtPrice = housePriceArray[foundIndex];
//set dynamic jpeg clip from value of photoArray
loadMovie(houseBigpicArray[foundIndex], BigphotoClip);
*/

trace("foundIndex!=null");

}
else{
trace("foundIndex really=null");
}

function findByID(houseID) {
//loop through the IDArray
for (j=0; j<houseIDArray.length; j++) {
//if the passed argument equals an Array value...
if (houseIDArray[j] ==houseID) {
//return the index of the matching value
return j;

}
}
//if nothing is ever found, return null
trace("foundIndex2=null");
return null;
}

gotoAndStop("big");

}

thanks for anyone that can help me with this!!

***. Arrarys, Finding Index, Loading Called Pic From Found Index
I am fairly new to flash, so thanks for bearing with me - here is my problem -
1. I have a bunch of associated arrays, populated from an xml file.
2. I have a dyn mc that displays thumbs, based on the info from the arrays.
3. if the user clicks on the thumb, I want the on release to trigger (among other things) a function that will find the index of, say, "houseID" so I can then apply that index in loading up a different(big) jpg , and other info pertinent to that thumb.
here is my code for the button:
on (release) {
//carry ID being the variable passed thru "oneHouse" function
CarryID=this.houseID;

trace("houseid"+houseID);
_parent.oneHouse(CarryID)
//"big" being the frame label
_parent.play("big")
}

-----------------------
here is code from a frame -

foundIndex = findByID(CarryID);
if (foundIndex != null) {
/*set dynamic textbox values from Arrays
all this stuff is not set up yet...
txtLocation = houseLocationArray[foundIndex];
txtBed = houseBedArray[foundIndex];
txtBath = houseBathArray[foundIndex];
txtPrice = housePriceArray[foundIndex];
//set dynamic jpeg clip from value of photoArray
loadMovie(houseBigpicArray[foundIndex], BigphotoClip);
*/

trace("foundIndex!=null");

}
else{
trace("foundIndex really=null");
}

function findByID(houseID) {
//loop through the IDArray
for (j=0; j<houseIDArray.length; j++) {
//if the passed argument equals an Array value...
if (houseIDArray[j] ==houseID) {
//return the index of the matching value
return j;

}
}
//if nothing is ever found, return null
trace("foundIndex2=null");
return null;
}

gotoAndStop("big");

}

thanks for anyone that can help me with this!!

Loading Swf + Double Clicking = Double Load -> Crash
Hello, help plz:

Have a button assigned to loading an swf, if the button is pressed twice the swf reloads and crashes, probably reloads data together and dosnt recognize, web crashes and needs to be reload reloaded... any suggestions?

thanks

Need Code For Moving
How to put something to move left or right.... ?

Moving Mcs With Code
Hallo,
is there any way to move a mc from here to there, with ease-out tweening, from some code put in the first frame of the main timeline?
Thank you very much
m.

Smooth Moving By Code
Hope this isn't too basic a question ... How do I smoothly move/scroll a movie clip with code - activated by rolling over a button?

In other words, I want the user to rollover a button and that to cause an image to move smoothly a certain distance and then stop.

Thanks, appreciate any help
Peter

External Code Help Moving Mc
I'm working on an assignmetn where I am required to write the code externally (not on the movie clips on the stage). I need to write code to move an object with a keypress. I've got some code that works (I tested a trace statement) but does not move the object. Anybody willing to take a look at the code below and give me some pointers??? The moveCircle is where my problem is.
Thanks!

class Circle extends MovieClip {

// Properties
private var _circle:MovieClip = null;
private var _keytest;
private var _jump:Boolean;

function makeCircle() {
var _circle = _root.attachMovie("ball", "ball", _root.getNextHighestDepth());
_circle._x = 50;
_circle._y = 320;
}

function moveCircle (){
var oKeyListener:Object = new Object();
oKeyListener.onKeyDown = function ():Void {
if (Key.isDown(Key.UP)){
trace("The up key was pressed");
_jump = true;
_root._circle._y -=100;
}//end if
}//end oKeyListener
Key.addListener(oKeyListener);
}//end moveCircle

FMX Problems With Moving Code
suppose i have the following code on a movieclip

ActionScript Code:
onClipEvent(load){var someVariable = 0someFunction = function(){//do something}}onClipEvent(enterframe){someVariable++if(!_parent.something){someFunction()}}


and i want to put that code INSIDE a frame of the movieclip instead of ON the movieclip, i would have to use this.onLoad = function() {blah blah} and this.onEnterFrame = function() {blah blah} and you would suppose it would work the same, but it doesnt work at all. Am i doin something wrong? i appreciate all comments/advice/etc...

Moving Objects Code
Hi everybody, I am trying to find out a formula to move an object, from on point to another, in a variable speed (fast at first, slowing down at the end).
This is what I have came out with. Can anyone suggest a better way?

Thanks a lot for your help


Code:
speed=5;
this.onEnterFrame = function() {
my_mc._x += (desiredXcoordinate - my_mc._x) / speed;
};

FMX Problems With Moving Code
suppose i have the following code on a movieclip

ActionScript Code:
onClipEvent(load){var someVariable = 0someFunction = function(){//do something}}onClipEvent(enterframe){someVariable++if(!_parent.something){someFunction()}}


and i want to put that code INSIDE a frame of the movieclip instead of ON the movieclip, i would have to use this.onLoad = function() {blah blah} and this.onEnterFrame = function() {blah blah} and you would suppose it would work the same, but it doesnt work at all. Am i doin something wrong? i appreciate all comments/advice/etc...

Index.html Vs. Index.swf (fullscreen) Help
Hi,

I am working on a site and what I am trying to get is the flash movie to load full screen (so there is no scroll bars). How can I set it so that when they go to the website it loads the index.swf file and not the .html file

my example is www.iccimmigration.com/index.swf (this is what I want, no scroll bars)

The index.html file with all margins set to 0... but what happens is when someone views the site with a higher screen resolution the movie is only half the screen.

www.iccimmigration.com

I hope that made some sense. I want it to load the .swf file not the .html

Moving From Code To Frame And Back
What I want to create is a piece of code that at a certain point, goes to a different scene, then returns to that part of the code where it left off. Heres an example based on when im trying to write.
if (level == 2){
enemiesLeft = 12;
bossNow = true;
gotoAndPlay("shySpy", 1);
}
Is there an easy way to do this? Im currently planning on replicating the code for the different levels (if that would work) as a possible alternative, but coding it like this would be easier if its possible.
Thanks for your help peoples

[F8] Why Doesn't This Code Produce Another Moving Mc?
Hey all,

I am trying to produce a scolling mc that is duplicated every 30 pixels. Each duplicate will scroll right behind the other along the x-axis.

My code will make the first mc scoll and it even produces a duplicate(s) at pixel 40, but the dups don't move and I think there are even a lot of dups that are just laying on top of each other.

BELOW IS THE CODE:

var ball:MovieClip;
var speed:Number=5;

ball.onEnterFrame = function():Void
{
this._x += speed;

if(ball._x==300){
ball._x=0;
}

//Start of duped mc
if(ball._x==40)
{
duplicateMovieClip(ball, "ball"+i, getNextHighestDepth()+i);
for(i=0; i<20; i++)
{


ball[i].onEnterFrame = function():Void
{ball[i]._x = 0;
this._x += (speed + (i*20));

if(ball[i]._x==300)
{
ball[i]._x=0;
}
}
//removeMovieClip(ball[i]);//does this really work?

}
}
trace(ball[i]._x);
};




Anyone have any ideas on how to make this work correctly?

Thanks.

[CS3] Moving Code From Parent To Child
Hi all,

I was wondering if someone could help me with what I'm sure is a very simple problem, but one that i've been stuck on for ages (as i'm not a very experienced AS user). I'm working on a project where the AS was written largely by someone else - previously the swf displayed an image from an external xml file using the below code:


PHP Code:



if(playlist_array[track_index].image!=undefined){
        cover_mc.content_mc.createEmptyMovieClip("photo"+track_index,track_index)
        cover_mc.content_mc["photo"+track_index].loadMovie(playlist_array[track_index].image)
    }else{
    }




However I want to display the same image within a new movieclip i've created one level down from the root, with the instance name 'ddmenu'. I used the below AS with no joy (returns a blank):


PHP Code:



if(playlist_array[track_index].image!=undefined){
        ddmenu.cover_mc2.content_mc.createEmptyMovieClip("photo"+track_index,track_index)
        ddmenu.cover_mc2.content_mc["photo"+track_index].loadMovie(playlist_array[track_index].image)
    }else{
    }




Is anyone able to tell me what I'm doing wrong?

Thanks,

Owen

Moving Code From Class To Stage
I have this code in a class that retrieves todays date. How can I show the date in a textfield?
Or can I modify the code and just put it in my scene so I won't have to call the class?








Attach Code

package {
import flash.display.Sprite;

public class DateExample extends Sprite {

public function DateExample() {
var someBirthday:Date = new Date();
trace(someBirthday.getDate());
}
}
}

























Edited: 11/17/2008 at 12:22:52 PM by lammspillning

Moving MC To One Fla To Another And Code Dont Work
When i move some MC or elements between fla movies, with the code, frames, and layers it need to work, some code stop to work, anyones know why?

Regards.

Why Doesn't This Code Produce Another Moving Mc?
Hey all,

I am trying to produce a scolling mc that is duplicated every 30 pixels. Each duplicate will scroll right behind the other along the x-axis.

My code will make the first mc scoll and it even produces a duplicate(s) at pixel 40, but the dups don't move and I think there are even a lot of dups that are just laying on top of each other.

BELOW IS THE CODE:

var ball:MovieClip;
var speed:Number=5;

ball.onEnterFrame = function():Void
{
this._x += speed;

if(ball._x==300){
ball._x=0;
}

//Start of duped mc
if(ball._x==40)
{
duplicateMovieClip(ball, "ball"+i, getNextHighestDepth()+i);
for(i=0; i<20; i++)
{


ball[i].onEnterFrame = function():Void
{ ball[i]._x = 0;
this._x += (speed + (i*20));

if(ball[i]._x==300)
{
ball[i]._x=0;
}
}
//removeMovieClip(ball[i]);//does this really work?

}
}
trace(ball[i]._x);
};


Anyone have any ideas on how to make this work correctly?

Thanks.

Urgent, Please Help Moving X Position In This Code
Hi people!

I have this script, that zooms and fades the movieclip but i also need to shift the position slightly from the start state to the end state.

For example var startX = 60 var endX = 70 so when the zoom start it starts at x = 60 and slowly moves as it zooms out to x = 70.

Can anybody help please?

Smooth Moving A Movie By Code
Hope this isn't too basic a question ... How do I smoothly move/scroll a movie clip with code - activated by rolling over a button?

In other words, I want the user to rollover a button and that to cause an image to move smoothly a certain distance and then stop.

Thanks, appreciate any help
Peter

[AS] Help With Moving Functional Stage Code Into Functions
Ok, I can't get this to work. I'm still confused about functions apparently. I'll worry about for loops later but I need to get basic functionality first. I'm guessing the problem is with pathing? When mainMenuVisible is called you are on aboutBut (this.menuMC.aboutBut) therefore this._parent.mainMenuVisible will take you back to menuMC and in line for (i.e. homeBut.visible). Thanks for the help.

also, the trace doesn't register and putting the function imputs (i.e. true, false) in "" doesn't work either.

mainMenuVisible = function (btn1, btn2, btn3, btn4, trc) {
homeBut._visible = btn1;
aboutBut._visible = btn2;
portBut._visible = btn3;
contBut._visible = btn4;
trace(trc);
}

this.menuMC.aboutBut.onRelease = function() {
this._parent.mainMenuVisible(true, false, true, true, "test");
}

Moving Embed Code Into Linked Files
Hello all,

I am trying to "optimize" some of my web pages by moving as much code as possible into linked files. I'm using Flash 8 in conjuction with Dreamweaver 8 and am wondering if it's possible to put all the code thats generated to embed Flash movies into a page into a linked file, and if so, how?

Any direction will be much appreciated,

Scott

Problem Moving Code From Timeline To Doc Class
Hi,

I am pretty new to AS. I'm trying to move some working AS3 code from the main timeline to a doc class but am getting a series of error messages. Can anyone tell me what I'm doing wrong? I'm attaching the FLA and AS files. The AS has my code attempt at the top and the original code (from the timeline) commented out at the bottom. Thanks for any help!

M

Moving Menu Links On Rollover - Code Help
http://www.westerndestinations.com/www3/index3.html

I finally figured out how to get my rollover links to work, but now I need to figure out how to make the bottom links move. For example, when we rollover the Arizona Link, we want the California and Contact Us links to move BELOW the Arizona rollovers. And same thing for when the California link is rolled over, we want the Contact Us link to move BELOW the California roll overs.

I feel like it's just a matter of simple code manipulation where I have the rollover code for the individual links, the code I have is below:

on (rollOver) {
CAmenu.play();
}

Moving Embed Code Into Linked Files
Hello all,

I am trying to "optimize" some of my web pages by moving as much code as possible into linked files. I'm using Flash 8 in conjunction with Dreamweaver 8 and am wondering if it's possible to put all the code thats generated to embed Flash movies into a page into a linked file, and if so, how?

Any direction will be much appreciated,

Scott

Moving A Variable From A Function To A Single Line Of Code
Hi guys im having trouble getting the var name_ent1 out of this function. could some one help?

var name_ent1
setPaper = function {
name_ent1 = this.text;
trace(name_ent1)
names.tester.text = name_ent1.text();


};



I would like to display the variable name_ent1 in the below line of code,
so i have decalred the var outside the function but it still doesn work.

pre_body_1 = "It was the celebrity wedding of the year as" +name_ent1+ "married";

Why Isnt This Code For Moving An Object Working? & Questions
Im a complete actionscript noob, started 2 hours ago lol... however, I know 3-4 other programming languages, and about 5 other design/layout/database languages, so i've picked it up quite fast, its like Javascript...
Im using Macromedia Flash Professional 8

First the question:

Question 1: for a button; do I have to import an image, and use it as a button, or can I draw an image/thing in my flash program (GUI), or in actionscript, write an image/drawing, and then somehow store it into a variable, and then "do" stuff with it, say "move it" etc...

Now the problem

Anyway, Im trying to make a "circle" that has been drawn, move...


Code:
this.createEmptyMovieClip("main", 1);
main.lineStyle(2, 0x000000, 100);
main._x = 265;
main._y = 180;
locx = Array(2);
locy = Array(2);
loop = 3
for (t=0; t<(loop-1); t++)
{
locx[t] = 5 + (5 * (t*2));
locy[t] = 5 + (5 * (t*2));
}
main.createEmptyMovieClip("circle", 5);
CircleRadius = 75;
main.circle.lineStyle(0, 0x000000, 100);
main.circle.moveTo(CircleRadius, 0);

for (l = 0; l<361; l++)
{
CircleRadAngle = l*Math.PI/180;
xv = Math.cos(CircleRadAngle)*(CircleRadius);
yv = Math.sin(CircleRadAngle)*(CircleRadius);
main.circle.lineTo(xv, yv);
}

main.onEnterFrame = function()
{
for (i=0; i<(loop-1); i++)
{
main.circle.moveTo(locx[i], locy[i]);
}
}
so I draw a circle, and store an integer in locx, and locy, (being coordinates), , now I was doing a tutorial and it was getting me to write a clock, now I did that, and it worked great, im doing that same thing, I want to create a loop, so that the image repeatedly moves, but im not quite sure what im doing lol

Any help to what im doing wrong appreciated

Case-sensitivity Problem In Moving Actionscript Code From Flash 6 To 7
Hi, everyone

I have an app with tons of code(two years of work) in Actionscript 1.0. Now I am going to upgrade my app to Flash 7. Since the app is huge, it's not easy to manually convert all the non-case sensitive variables to be case-sensitive.

Now I plan to write a small compiler program to convert every non-case sensitive variable to its lowercase counterpart.

For the code in the *.as, it might be easier since I can search all the variables and do some processing work.

However I have no any idea how to search the code embeded in the .fla files and convert the non-case sensitive variables?

Any suggestion welcomed

Duplicating Clip Code - Dynamic Naming And Moving - Syntax Error
This code should duplicate a clip, and increase the name by 1. What am I doing wrong?


Code:
duplicateMovieClip(thWin1, "thWin"+[_root.thWinNum], this.getNextHighestDepth());
thWin+[_root.thWinNum]._x=thWin+[_root.thWinNum-1]._x+54.8;
Thank You,
-Kirk II

How To LoadMovie Into This Code
Hi

I have this example from http://www.flashvalley.com/fv_tutori..._and_getPixel/
which picks color from a image which is loaded from the flash library. I want to use loadMovie method to load image from a given path. But when I am doing the movie doesn't work fine it gives only black color all the time.

Can some one guide me here


Code:
import flash.display.BitmapData;

linkageId = "landscape";
myBitmapData = BitmapData.loadBitmap(linkageId);

mc = this.createEmptyMovieClip("mc", 0);
mc.attachBitmap(myBitmapData, 0);

selectedColor.swapDepths(_root.getNextHighestDepth());
newColor = new Color(selectedColor.sample);

onMouseMove = function(){
myNewColor = "0x" + myBitmapData.getPixel(_xmouse,_ymouse).toString(16);
newColor.setRGB(myNewColor);
selectedColor.colorValue.text = myNewColor;
}

Scaling An SWF When Using LoadMovie Code
I am trying to use the "loadMovie" code to load an external swf file. I haven't had any problems with that. I can load it correctly, place it correctly and all that stuf.

My problem is that the SWF file I wish to load is not of the correct dimensions for the desired location space. Is there any way that I can make the SWF file be scaled to specific dimensions when it loads?

Please help! thanks!

LoadMovie Works But I Can't Get The Code To Come In. :O(
I've made a scrolling image viewer using the following code, (yeah I suck at coding. )

_root.onEnterFrame = function() {
movieCenter = _root.centerLine._x;
mousePosX = _root._xmouse;
mousePosY = _root._ymouse;
var speed = (mousePosX-movieCenter)/18;
if (mousePosX>25 && mousePosX<561) {
// slides area
if (mousePosY>459 && mousePosY<545) {
// slides area
for (i=1; i<=7; i++) {
if (mousePosX<movieCenter) {
_root["box"+i]._x += speed;
}
if (mousePosX>movieCenter) {
_root["box"+i]._x += speed;
}
if (_root["box"+i]._x>movieRight._x) {
_root["box"+i]._x -= 977; ;
}
if (_root["box"+i]._x<movieLeft._x) {
_root["box"+i]._x += 977;
}
}
}
}
};


However, when I do a loadMovie on my main movie since I have this a seperate .swf and loading into a mc_holder my images won't scroll when I roll over them. I've tried changing the _root to everything else as well as tried it without the _root etc. Can anyone help me as to how I can get this loaded into my main scene? I will also attach the file so someone else can either use the scroller or at least try doing a loadMovie to get it to work.

Also, can anyone get it to not stop abruptly when you scroll off the hitzone area, right now it just stops and I'd like it to continue at the speed you scrolled off or gradually come to a stop.

Yeah I must really suck. I can't even get a scroller to work when loaded in from a seperate swf. It seems like anything coded that doesn't just have a regular rollover or animation doesn't work when I do a loadMovie to a main scene. Maybe I'm just an idiot but I've tried _root's etc. What do all the good and real flash guru's do to make these coded items work. I know with the one I posted above it needs to be in a certain place for the scroller to work, does the load movie take this into account in the new movie and not allow for cooridinates because the size and dimesnions are different? I've even tried taking off the cooridinate checker that makes you need to have the mouse directly over the movie tho and it still didn't work. I'm just a stupid artist I guess, please help with the code part.

Here's the page it's goin on, so obviously I can make some thing's, but grr don't know what I'm doing wrong with the loadMovie stuff.
http://www.fullthrottlesaloon.com/_new/Site_2-25.html

Thanks
so much!!!

[F8] LoadMovie Breaks My Code
I am using the following in conjunction with an XML file to dynamically load data:

Code:
for (i=0; i<myXML.firstChild.childNodes.length; i++) {

title = (myXML.firstChild.childNodes[i].attributes.linker);

this.attachMovie("blanker", title, i+10);

thisItem = this[title];

thisItem.title = (title);
picName = title + ".jpg";
thisItem.loadMovie(picName);

thisItem._X = myX+= (thisItem._width)+2;
thisItem._Y = myY;

thisItem.onRollOver = function(){
populateInfo(this.title);
}
thisItem.onRollOut = function () {
_root.info = "";
}
}
The populateInfo function should be called when I rollover the instances, but it isn't. I have done a little research and it looks like I have to wait until the jpeg is completely loaded into the file first.

I tried the following and that didn't work after putting an empty movieclip on the stage:

Code:
controller_mc.onEnterFrame = function(){

var bl = thisItem.getBytesLoaded();
var bt = thisItem.getBytesTotal();

if(bl>4 && bl>=bt){
thisItem.onRollOver = function(){
populateInfo(this.title);
}
thisItem.onRollOut = function () {
_root.info = "";
}
delete this.onEnterFrame;
}
}
I understand what I need to do, but I'm unsure how to do it. This tutorial explained why my onRelease functions wouldn't work, but I'm still confuzzled. Any help would be appreciated.

[CS3] LoadMovie Code Problems
I tried getting help for this a few days back, but I dont think I worded my post well enough.

My problem seems very minor and easy to fix.. so I'm just looking for some friendly advice. Excuse my knowledge of proper technical terms.

I'm using loadMovie to bring in some external swfs into my main swf. But a lot of the coding inside these external swfs stops working when viewed/accessed from the main movie.

for example:

Here is a flash movie which uses loadMovie to bring in a swf with a button on it:

http://ediblecastle.com/example/mainmovie.html

There is a getUrl code on the button which doesnt work.

If you access the external swf directly (http://ediblecastle.com/example/button.swf), the getUrl code works just fine.

Could someone clear this up for me?

Cheers.

LoadMovie And Relation In Code
Here's my problem: i got a main SWF playing. At the end, another swf is loaded inside an MC named dropZone with "loadMovie" actionscript.
but inside my second swf, i got a dynamic textbox called content_TXT in an MC named texteMC who load a html file, and a custom scrollbar called slider.
If I do CTRL+ENTER to test the movie itself, work fine, everything is scrolling right. but if i put all thing on web server, the scrollbar is no more scrolling the dynamic text. here's some code:

texteMC actionscript
onClipEvent (enterFrame){
_parent.texteMC.content_TXT.scroll = _root.slider.b;
}

slider actionscript
onClipEvent (load){
setProperty (this, _x, int(_x));
}
onClipEvent (enterFrame){
a = new Object();
a.y = this._y;
a.x = this._x;
_parent.path.globalToLocal(a);
b = int(a.y/(100/_parent.texteMC.content_TXT.maxscroll));
}

IF anyone can help to solve this scrolling problem, that's gonna be great. I'm sure this is a question of _root or _parent somewhere but can't put the finger on it....





























Edited: 10/03/2007 at 08:17:08 AM by Raskriall

LoadVariables Into LoadMovie Code Help
I can't figure out why this code doesn't work. I am banging my head here!

Code:
ShowBanner.onEnterFrame = function() {
this.loadVariables("http://www.mysite.com/echo.php", 0);
this.loadMovie(this.banner, 0);
}
echo.php simply echos "banner=http://www.mysite.com/flashfile.swf"
I used a dynamic input text box to catch the value of banner - and it works fine! So I know the loadVariables is working but I can't get loadMovie to actually load the movie. And if I replace this.banner with the text of the path to flashfile.swf, it loads the movie perfectly.

What is wrong that this.banner (which holds the right URL) yet loadMovie will not open the file?

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