A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: Flash / Php / Sql / As

  1. #21
    the other one
    Join Date
    Mar 2001
    Posts
    96

    last query on this subject

    Allright after trying many different variations, I have ended with this below.

    It does not work and has killed my pop up window ( my url defenition stinks). I was wondering if you could possibley have a look at it and debug. What I would it to do is every button to load a data file into the "0" level. This will be the data from my db. Is this a viable way to create a semi dynamic content site ??


    AS
    ************************************************** ***************
    stop ();

    cir_color = new Color(cir);

    with (data) {
    for (i=1; i<=numMenus; i++) {
    numLinks = (eval("menu"+i+"Links"))*1;
    set ("_root.menu"+i+".numLinks", numLinks);
    for (j=1; j<=numLinks; j++) {
    theTitle = eval("menu"+i+"Link"+j+"Title");
    set ("_root.menu"+i+".link"+j+".theTitle", theTitle);
    theLink = eval("menu"+i+"Link"+j+"Url");
    if(thelink.indexOf("http") == 0)
    set ("_root.menu"+i+".link"+j+".theLink", theLink);
    else
    { link[i].split(",");
    set ("link1"+i+".func", f[0]);
    set ("link1"+i+".fnarg", f[1]);
    }
    }}
    }
    ************************************************** ******
    If you would likr to peruse the src file let me know.
    Looking forward to any help you can offer.

    Kindest

  2. #22
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    loading one distinct file for every menu is no good idea - just combine all the variables into one file
    The last few lines should probably read
    else
    { f = theLink.split(",");
    set ("link1"+i+".func", f[0]);
    set ("link1"+i+".fnarg", f[1]);
    }
    for a proper split. I do not think I can understand why you want to use link1 here, however

    Musicman

  3. #23
    the other one
    Join Date
    Mar 2001
    Posts
    96

    Really the lat request

    Thanks for your response,

    loading one distinct file for every menu is no good idea - just combine all the variables into one file

    thats what I am doing for the menu headers and submenus, but then each submenu when selected loads a seperate file of combined variables.
    Is that acceptable ?

    The last few lines should probably read
    else
    { f = theLink.split(",");
    set ("link1"+i+".func", f[0]);
    set ("link1"+i+".fnarg", f[1]);
    }
    for a proper split. I do not think I can understand why you want to use link1 here, however

    I have tried some variations on the code and it is not working. I have got the file to successfully open my documents and settings folder when you click a link.

    Please could you have a look at the fla and see where I have gone wrong, it should work as far as I can see, do not feel obliged to make changes if you could have a look and just let me know where I have gone wrong I would appreciate it.The first sub menu link under corporate is reading a record that looks like this - gotoAndStop,30 - All the enteries under the home menu should be url's

    Excuse the bits and the look if you do download still experimental.

    and this really is my last attempt
    Kindest
    Last edited by BarryAllen; 10-17-2002 at 05:29 PM.

  4. #24
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    unfortunately I cannot help you on that - I do not use flash and hence cannot read your fla

    Musicman

  5. #25
    the other one
    Join Date
    Mar 2001
    Posts
    96

    cool

    Thats great (I am smiling), I have read some of your previous posts so I know you are Linux based.

    I have to ask:

    A) what platform does your coding knowledge (ActionScript) derive from ?
    B) If I post the code will you have a look ?

    Kindest and thanks

  6. #26
    the other one
    Join Date
    Mar 2001
    Posts
    96

    I've got to hit the hay so I am posting anyway

    // Frame 1
    stop ();
    loadVariables ("http://prototype.emarket2.com/admin/load_set.php", "data");
    // file is text below - too save your time
    // data is the targetted movie clip
    &menu1=Home&menu2=Corporate&menu3=Products&menu4=C lients&menu5=Location&numMenus=5&menu1Links=3&menu 1Link1Title=Home 1&menu1Link1Url=http://www.flashkit.com&menu1Link2Title=Home 2&menu1Link2Url=http://prototype.emarket2.com/Craig_Development/var.php?id=37&menu1Link3Title=Home 3&menu1Link3Url=http://prototype.emarket2.com/Craig_Development/var.php?id=38&&menu2Links=3&menu2Link1Title=Corpor ate 1&menu2Link1Url=gotoAndStop,30&menu2Link2Title=Cor porate 2&menu2Link2Url=&menu2Link3Title=Corporate 3&menu2Link3Url=&&menu3Links=5&menu3Link2Title=Pro duct 2&menu3Link2Url=&menu3Link3Title=Product 3&menu3Link3Url=&menu3Link4Title=Product 1&menu3Link4Url=&menu3Link5Title=Product 4&menu3Link5Url=&menu3Link6Title=Product 5&menu3Link6Url=&&menu4Links=2&menu4Link1Title=Cli ents 1&menu4Link1Url=fgshrtsh&menu4Link2Title=Clients 2&menu4Link2Url=fghrsthr&&menu5Links=2&menu5Link1T itle=Location 1&menu5Link1Url=&menu5Link2Title=Yemis Location&menu5Link2Url=&&


    // Frame 2
    play()

    // Frame 3
    stop ();
    with (data) {
    for (i=1; i<=numMenus; i++) {
    numLinks = (eval("menu"+i+"Links"))*1;
    set ("_root.menu"+i+".numLinks", numLinks);
    for (j=1; j<=numLinks; j++) {
    theTitle = eval("menu"+i+"Link"+j+"Title");
    set ("_root.menu"+i+".link"+j+".theTitle", theTitle);
    theLink = eval("menu"+i+"Link"+j+"Url");
    if(thelink.indexOf("http") == 0)
    set ("_root.menu"+i+".link"+j+".theLink", theLink);
    else

    { f = theLink.split(",");
    set ("link1"+i+".func", f[0]);
    set ("link1"+i+".fnarg", f[1]);
    }
    }}
    }


    ************************************************** ************************
    //I have 5 movie clips each is a menu named sequentially //menu1, menu2 ...,menu5

    //Inside menu1

    // Frame1

    stop ();
    direction = 0;
    openPos = _y
    originalPos = _y - (getProperty("link1", _height)*numLinks) - 20;
    for (i=2; i<=numLinks; i++) {
    duplicateMovieClip ("link1", "link"+i, i);
    linkPos = getProperty("link"+i, _y)+(getProperty("link"+i, _height)*(i-1)-1);
    setProperty ("link"+i, _y, linkPos);
    }
    setProperty ("menuBg", _y, getProperty("menuBg", _y)+(getProperty("link1", _height)*numLinks)+5);
    setProperty (this, _y, originalPos);

    // Frame2

    oldPos = _y;
    newPos = oldPos+(direction*10);
    if (direction==-1 and newPos>=originalPos) {
    setProperty (this, _y, newPos);
    }
    if (direction==1 and newPos<=openPos) {
    setProperty (this, _y, newPos);
    }

    // Frame3
    gotoAndPlay ( 2 );

    //Inside menu1 aand all the other menus 2-5
    // is another movie clip called - link1

    // inside link1 are two objects a button called - link which //has the followong action-

    on (rollOver) {
    tellTarget ("../") {
    direction = 1;
    play ();
    }
    }
    on (rollOut) {
    tellTarget ("../") {
    direction = -1;
    play ();
    }
    }
    on (release) {
    if (typeof (this.func) != 'undefined') {
    _root[this.func](this.fnarg);
    } else {
    getURL (this.url, "....");
    }
    }

    //and a dynamic //text field called - theTitle

    // an older online version is at http://prototype.emarket2.com/Craig_Development/2v.swf

    looking forward to any help you can offer if not I understand and appreciate the help you have given me.

    Kindest

  7. #27
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    a) I am using ming which creates swf from static data (conceptually like flash, a fla is static data as well) but can also create swf from dynamic sources. Ming does support most of actionscript but has somewhat stricter rules than flash (_every_ statement wants a semicolon) and sometimes more consistent behaviour
    b) no problem - best would be the actionscripts plus a swf to look at. In the specific case of your menu, I would like to have a look at the text files as well

    Musicman

  8. #28
    the other one
    Join Date
    Mar 2001
    Posts
    96

    swf

    cool thank you,

    Ming you say, i have been to the sites read the glib but thought i'd look into it in the distant future. Maybe a little sooner now.


    Once again thank you for your time and knowledge.


    most recent swf can be found here:

    www.spree.co.za/craig/research/4v.swf

    kindest

  9. #29
    the other one
    Join Date
    Mar 2001
    Posts
    96

    oops addenum

    if you download the swf to your desktop otherwise the data will not work from domain to domain.

    and the code on the link button should read -
    on (rollOver) {
    tellTarget ("../") {
    direction = 1;
    play ();
    }
    }
    on (rollOut) {
    tellTarget ("../") {
    direction = -1;
    play ();
    }
    }
    on (release) {
    if (typeof (this.func) != 'undefined') {
    _root[this.func](this.fnarg);
    } else {
    getURL (theLink);
    }
    }

    Also the most important part the dat movie clip has the following attached to it sorry it was late last night.

    onClipEvent (data) {
    tellTarget ("_root") {
    nextframe ();
    }
    for (i=1; i<=numMenus; i++) {
    numLinks = (eval("menu"+i+"Links"))*1;
    set ("_root.menu"+i+".numLinks", numLinks);

    }
    }


    Kindest



    Kindest
    Last edited by BarryAllen; 10-18-2002 at 05:06 AM.

  10. #30
    One man circus
    Join Date
    Oct 2002
    Location
    Connecticut
    Posts
    90
    BarryAllen -
    I was just wondering if you could help me out. I am trying to do somethign similar to what you are doing(flash/php/mysql), but it doesnt seem to work right, I would like to know if you can help me out through Aol instant messenger or msn messenger, since you have experience with this type of thing, when you get some free time. If you dont have a messenger system, I guess I could ask your advice through the fk forums. Anyways, hope to hear from you soon, thank you.

  11. #31
    the other one
    Join Date
    Mar 2001
    Posts
    96

    No problem

    Any help I can offer pls ask away.

    but I think MusicMan may have to jump in.

    Kindest

  12. #32
    One man circus
    Join Date
    Oct 2002
    Location
    Connecticut
    Posts
    90
    Ok, this is gonna be long ---
    So, i have this site, which i want to loadvariables from a php file. The url is http://www.arblanza.invisionworld.com/john/fight .
    Let me explain what I have so far. ( i used the php tag to make it organized)
    PHP Code:
    Main frame_root:
         
    A movie clip named "content"
         
    A dynamic text box with variable name "news"
         
    A home buttonnews buttonlogin buttonregister button.
         
    A lightbulb movie clip with instance name "brain"
    Every time you click one of the buttons, it sets _root.brain.event. For instance, the home button has the code _root.brain.event = "A";
    Now, on the brain movie clip.
    I have a bunch of actions, and its all coded to keep people from finding out how everything works (dont ask).
    The following is on the brain movie clip actions:
    PHP Code:
    onClipEvent (load) {
        
    end ".php";
        
    end2 ".swf";
        
    php "stuff";
        
    pg "page";
        
    "home";
        
    "news";
        
    "login";
        
    "register";
        
    "games";
        
    "battle";
        
    "shop";
        
    "signup";
        
    "help";
        
    "staff";
        
    a1 "name";
        
    a2 "password";
        
    a3 "gender";
        
    a4 "email";
        
    a5 "location";
        
    a6 "interests";
        
    stats = new Array();
        
    stats[0] = false;
        
    event A;
    }
    onClipEvent (enterFrame) {
        if (
    event == A) {
            
    _root.news "Loading....";
            
    _root.content.loadMovie();
            
    _root.loadVariables(php+end+"?RND="+random(999999)+"&"+pg+"="+A_root"GET");
            
    event "";
        }
        if (
    event == B) {
            
    _root.news "Loading.....";
            
    _root.content.loadMovie();
            
    loadVariables(php+end+"?RND="+random(999999)+"&"+pg+"="+B_root"GET");
            
    event "";
        }
        if (
    event == C) {
            
    _root.news "Loading....";
            
    _root.content.loadMovie(C+end2_root.content);
            
    event "";
        }
        if (
    event == D) {
            
    _root.news "Loading....";
            
    _root.content.loadMovie(D+end2_root.content);
            
    event "";
        }
        if (
    event == H) {
            
    _root.news "Loading....";
            
    loadVariables(php+end+"?RND="+random(999999)+"&"+pg+"="+H+"&"+a1+"="+_root.content.name+"&"+a2+"="+_root.content.pass+"&"+a3+"="+_root.content.gender.getValue()+"&"+a4+"="+_root.content.email+"&"+a5+"="+_root.content.location+"&"+a6+"="+_root.content.profile_root);
            
    _root.content.loadMovie();
            
    event "";
        }
        if (
    event == I) {
            
    _root.news "Loading....";
            
    _root.content.loadMovie(I+end2_root.content);
            
    event "";
        }
        if (
    event == J) {
            
    _root.news "Loading....";
            
    _root.content.loadMovie(J+end2_root.content);
            
    event "";
        }

    So, if event is equal to "A"
    it sets _root.news to loading, i did this so it will display the words loading while the text is loading into flash.
    Next line says _root.content.loadmovie(); content and news are overlapping, because for something i load text, from php and for somethings I use loadmovie to load an swf.
    Next line is the loadvariables. I have this:
    _root.loadVariables(php+end+"?RND="+random(999999) +"&"+pg+"="+A, _root, "GET");
    If you substitute the variables in, it should turn out like this:
    _root.loadVariables(stuff.php?RND=999999&page=home , _root, "GET");
    Now we have the php file, very short and everything.
    PHP Code:
    <?php
    if ($page == home) {
        echo 
    '_root.news =' "Welcome to the site.";
    }
    if (
    $page == news) {
        echo 
    '_root.news =' "No news yet";
    }
    ?>
    The file is called stuff.php
    So, i would think that when you click on the home button it would load the words Welcome to the site into the _root.news dynamic text box.
    But it doesnt. Well, im going to attach my fla file, and maybe you guys know where my problem is. Thanks.
    Attached Files Attached Files
    Last edited by zkitty; 10-20-2002 at 11:01 AM.

  13. #33
    the other one
    Join Date
    Mar 2001
    Posts
    96

    Hey

    If you can hold on. I'll have a look at the file when I'm in the office. No flash MX at home.

    Hey z from what I can see your ActionScript seems sound apart from the load variables and the way your php is formatted. pls can you dump a txt file of the php output here and i'll look at it tommorrow.


    PS are you giving the php time to load = a loop

    kindest
    Last edited by BarryAllen; 10-20-2002 at 02:56 PM.

  14. #34
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    just glancing at it ....
    your description says:
    if(something == "A")
    your code says:
    if(something == A)
    Is A a variable set to "A" somewhere before?

    Musicman

  15. #35
    the other one
    Join Date
    Mar 2001
    Posts
    96

    Process of elimination

    Hi Musicman,

    On the advice of jimburton from Actionscript.org I went through the file to see where I had gone wrong. I traced the output and found that the functions and arguments are not being defined.

    Please could you have a look at the following and see where I have gone wrong. I have included my trace.

    Kindest

    ************************************************** **************
    as on frame 3
    ************************************************** **************
    stop();
    with (data) {
    for (i=1; i<=numMenus; i++) {
    numLinks = (eval("menu"+i+"Links"))*1;
    set("_root.menu"+i+".numLinks", numLinks);
    for (j=1; j<=numLinks; j++) {
    theTitle = eval("menu"+i+"Link"+j+"Title");
    set("_root.menu"+i+".link"+j+".theTitle", theTitle);
    theLink = eval("menu"+i+"Link"+j+"Url");
    set("_root.menu"+i+".link"+j+".theLink", theLink);
    if (theLink.indexOf("http") == 0) {
    trace("this is an url");
    trace(theLink);
    } else {
    f = theLink[i].split(",");
    set("theLink"+i+".func", f[0]);
    set("theLink"+i+".fnarg", f[1]);
    trace("this is not an url");
    trace(func);
    trace(fnarg);
    }
    }
    }
    }
    ************************************************** **************
    my trace output where : this is not an url, should be a function
    ************************************************** **************
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is an url
    http://www.testing.com
    this is an url
    http://www.testing.com
    this is an url
    http://www.testing.com
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is not an url
    undefined
    undefined
    undefined
    this is an url
    http://www.flashkit.com
    this is an url
    http://www.testing.com
    this is an url
    http://www.testing.com

    *****************************************
    This is the action on my button
    *****************************************
    on (release) {
    if (func = "showframe(x)") {
    _root.gotoAndPlay(x);
    trace(func);
    } else {
    getURL (theLink);

    }
    }


    looking forward to any help
    Kindest

  16. #36
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    you use this code to set the url:
    set("_root.menu"+i+".link"+j+".theLink", theLink);
    now, this should be replaced by
    if(theLink.indexOf("http") == 0)
    set("_root.menu"+i+".link"+j+".theLink", theLink);
    else
    { f = theLink.split(",");
    set("_root.menu"+i+".link"+j+".func", f[0]);
    set("_root.menu"+i+".link"+j+".fnarg", f[1]);
    }
    You should perhaps not test the func against a string like showframe(x) but rather add a real showframe function at the root

    The traces you are doing print the value of theLink but should rather print the value of _root.menu3.link2.theLink or such - similarly the func and fnarg of a particular element should be traced.

    Some time before I wrote .... for a geturl - this should be the window where you want the external link to appear, such as _blank (new window), _self (replace movie by link) or a html frame

    Musicman

  17. #37
    One man circus
    Join Date
    Oct 2002
    Location
    Connecticut
    Posts
    90
    Yes music man, A is set to "home" earlier in the code under the onClipEvent(load).

  18. #38
    the other one
    Join Date
    Mar 2001
    Posts
    96
    Ignore below its working dude, you are the man.

    Thank you so much, my understanding has increased by leaps and bounds.

    Yea Man




    All right Musicman,

    In case I have not been clear all I want the buttons to do is go to a frame within the flash file. They are accessing external url's fine now(not opening my desktop file).

    I am almost there, the functions and arguments are now being defined. The following is a trace from my main flash file.

    ************************************************** *************
    The trace is: Is this an url, if so what is the argument and the function. Works different variations (label name label no.)********************************************** *****************
    this is not an url
    showframe,aboutus
    showframe
    aboutus
    this is not an url
    showframe,10
    showframe
    10
    this ia an url
    http://www.flashkit.com/
    etc.etc.

    ************************************************** *************
    On each button I have a trace. This produces the following:
    ************************************************** *************
    showframe <--------- Function
    aboutus <--------- Argument
    undefined <--------- If url what url
    ************************************************** *************

    The missing bit would seem to be (apart from my lack of understanding, which is improving) the function to interpret my showframe function and label name or number.

    I have tried many variations

  19. #39
    the other one
    Join Date
    Mar 2001
    Posts
    96
    Musicman,

    just wanted to thank you again,

    zKitty as soon as I get some time I'll look into your problem have to learn some more php first.

  20. #40
    One man circus
    Join Date
    Oct 2002
    Location
    Connecticut
    Posts
    90
    Ok, i figured that problem out. Just messed with stuff and it started working. Anyways, I have another problem.
    I have a movie clip that I want to go to frame 2 when a variable, _root.brain.logged is equal to "yes". I have on the movie clip i have:
    [code]
    onClipEvent (enterFrame) {
    if (_root.brain.logged == "yes") {
    gotoAndStop(2);
    } else {
    gotoAndStop(1);
    }
    }
    [code]
    And in the php i have:
    PHP Code:
    if ($page == "home") {
       echo 
    "news=Hello, welcome to the site&";
       echo 
    'brain.logged=yes&';

    I see the variable say yes, but it doesnt move to the 2nd frame. I'm guessing that it is formatted differently from being sent from php, but i am not sure. Any suggestions? Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center