Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14

    Copiare gallery in flash xml

    Ciao a tutti, ho bisogno urgente di aiuto, ho un tempalte flash xml con una pagina (tra le altre) con una gallery che carica immagini da un file xml, vorrei copiare la gallery in un'altra pagina ho fatto copia incolla ma non riesco a trovare il modo per far caricare delle altre immagini diverse, mi carica sempre quelle della gallery copiata. Grazie in anticipo e complimenti per i forum, davvero utili.

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Devi cambiare il nome del xml e della cartella che contiene le immagini, naturalmente nell'actionscript devi fare riferimento al nuovo nome del file xml.

  3. #3
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    ho inserito nel file xml dove ho <gallery> ....... </gallery>
    altre righe <galleryxxx>... posizione cartella file ... </galleryxxx>
    ma nell'actionscript trovo solo tra le altre righe di codice la dicitura gallery che ho sostituito con galleryxxx ma non funziona. Se ti può essere utile ho un altro file galleryproject con le varie cartelle caurina , ecc. devo forse cambiare qualcosa li oppure ho sbagliato io alle modifiche all'actionscript (magari dovevo farlo in alro punto o altro livello - mi carica le immagini in una scroll line)

    Grazie.

  4. #4
    ma devi duplicare il file xml....cambiare il suo nome e di conseguenza cambiare il nome nell'actionscript....dell'xml che carica e poi vai a cambiare le foto nel nuovo file xml....
    nn devi modificare la lettura del file ne il file xml

    la verità non è una meretrice che si getta al collo di chi non la vuole ma anzi essa è dotata di una così altera bellezza che anche chi sacrifica tutto per ottenerla non è sicuro di averla raggiunta !

  5. #5
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    ho provato, ho una scroll movie popup gallery con il seguente actionscript:

    import caurina.transitions.Tweener;
    import gs.*;
    import gs.easing.*;
    var mc_content:MovieClip;
    var rectangle;
    var clickedisplayObject;
    var kk:Number;
    var gallLength:uint=MovieClip(root).websiteXML.gallery .image.length();
    var delen:uint=track.height/gallLength;
    var cur_pic:uint;
    var tempCur:uint=0;

    function deact() {
    this.visible=false;
    var par:MovieClip=parent as MovieClip;
    Tweener.removeTweens(mc_content);
    par.removeEventListener(MouseEvent.MOUSE_WHEEL, mouse_well);
    }

    deact();
    var par:MovieClip=parent as MovieClip;
    this.mc_content=par.dynamic_page_content;
    var d_C=(this.mc_content.width/2)-0;


    scroll_button.y=0;
    this.mc_content.y=par.dynamic_page_content.y;
    if (d_C>0) {
    kk=d_C/Math.round(track.height-scroll_button.height);

    rectangle=new Rectangle(track.x,0,0,Math.round(track.height-scroll_button.height));
    scroll_button.addEventListener(MouseEvent.MOUSE_DO WN, scroll_drag);
    scroll_button.buttonMode=true;
    par.addEventListener(MouseEvent.MOUSE_WHEEL, mouse_well);
    stage.addEventListener(MouseEvent.MOUSE_UP, scroll_drag_stop);
    stage.addEventListener(MouseEvent.MOUSE_UP, captureMouseUp, true);
    this.visible=true;
    } else {
    this.visible=false;
    }



    function scroll_drag(event:MouseEvent):void {
    scroll_button.addEventListener(Event.ENTER_FRAME, scroll_move);
    scroll_button.startDrag(false, rectangle);
    }
    function scroll_drag_stop(event:MouseEvent):void {
    scroll_button.removeEventListener(Event.ENTER_FRAM E, scroll_move);
    scroll_button.stopDrag();
    }
    function scroll_move(e:Event=null):void {
    if (MovieClip(root).isGall==false){
    var d_scroll:int = Math.round((scroll_button.y-0)*kk);
    Tweener.removeTweens(mc_content);
    Tweener.addTween(mc_content,{x:-d_scroll, time:1, transition:"easeOutQuart"});}else{
    //////////////////////////////////////////////////////
    cur_pic = Math.floor(MovieClip(parent).mouseX/delen);
    if ((cur_pic>=0)&&(cur_pic<=gallLength-1)){
    if (tempCur!== cur_pic){tempCur=cur_pic; MovieClip(root).numGallImages=cur_pic;
    TweenLite.to(MovieClip(parent).gl, 2.5, {x:-980*MovieClip(root).numGallImages, ease:Sine.easeOut } );
    }
    }
    }

    }
    function mouse_well(e:MouseEvent) {
    var a:Number=scroll_button.y;
    a-=e.delta;
    if (a<rectangle.y) {
    a=rectangle.y;
    }
    if (a>rectangle.y+rectangle.height) {
    a=rectangle.y+rectangle.height;
    }
    scroll_button.y=a;
    scroll_move();
    }
    function captureMouseUp(evt:MouseEvent):void {
    if (evt.eventPhase==EventPhase.BUBBLING_PHASE) {
    return;
    }
    if (clicked==scroll_button) {
    clicked=null;
    var target:Sprite=evt.target as Sprite;
    if (target==scroll_button) {
    scroll_drag_stop(evt);
    } else {
    scroll_drag_stop(evt);
    }
    }
    }
    non trovo la dicitura main.xml da sostituire, non è che mi prende le info dal file galleryproject.as o dal file .js? Se così come posso fare a fare l'aggiunta?

  6. #6
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    il file galleryproject è il seguente:
    package
    {
    import com.*;
    import flash.media.Sound;

    import flash.display.MovieClip;
    import flash.display.DisplayObject;
    import flash.display.StageAlign;
    import flash.display.StageDisplayState;
    import flash.display.StageScaleMode;
    import flash.display.Loader;
    import flash.geom.Rectangle;

    import flash.events.*;

    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;

    import flash.media.SoundChannel;
    import flash.media.SoundTransform;

    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.URLRequestMethod;

    import flash.media.SoundChannel;
    import flash.media.SoundTransform;

    import caurina.transitions.Tweener;
    //import caurina.transitions.properties.FilterShortcuts;

    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.text.TextField;
    import flash.text.TextField;
    import flash.utils.setTimeout;

    import tm.com.*;

    import gs.*;
    import gs.easing.*;

    public class GalleryProject extends MovieClip {

    private var quality:Number = 1;

    private var _root = root as MovieClip;
    private var _parent = parent as MovieClip;

    private var pcent:Number;
    private var xmlURL:String = 'xml/main.xml';
    private var xmlURL:String = 'xml/maingallerysacra.xml';
    private var titleFormXML:String="xml/formConfiguration.xml";

    public var pcentXML:Number;
    public var websiteXML:XML;
    public var confXML:XML;
    public var xmlLoader:URLLoader;

    public var linkPage:Number = 0;
    public var numGallImages:Number = 0;
    public var titleGallery:Number = 0;

    private var rectangle:Rectangle;

    public var xmlFormLoader:URLLoader;
    public var request:URLRequest;
    public var variables:URLVariables;
    public var formItems:Array = [];

    private var soundTitle:Boolean = true;
    private var fullTitle:Boolean = true;

    private var closeSplash:Boolean = false;

    public var st:SoundTransform = new SoundTransform(1);
    public var channel:SoundChannel;
    public var animation:Boolean = true;

    public var animation_pic:Boolean = false;

    public var isGallery:Boolean = false;

    public var chargeValue:int = 15;

    public var soundCurId:uint = 0;

    public var isGall:Boolean = false;

    //public var gallery:Gallery;

    public function GalleryProject()
    {
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;

    addEventListener(Event.ENTER_FRAME, MAIN_LOADING);

    function MAIN_LOADING(event:Event) {
    if (stage) {
    var bytesTotal = stage.loaderInfo.bytesTotal;
    var bytesLoaded = stage.loaderInfo.bytesLoaded;

    MovieClip(root).loadingMovie.pr.loaderText.htmlTex t = Math.floor(bytesLoaded * 100 / bytesTotal) + '%';
    MovieClip(root).loadingMovie.pr.loaderText.autoSiz e=TextFieldAutoSize.CENTER;

    MovieClip(root).loadingMovie.gotoAndStop(Math.floo r(bytesLoaded * 100 / bytesTotal));
    if (bytesLoaded >= bytesTotal) {
    removeEventListener(Event.ENTER_FRAME, MAIN_LOADING);
    MovieClip(root).gotoAndStop(2);
    loaderXML();
    } {
    _root.stop();
    }
    }
    }

    }
    public function loaderXML() {

    xmlLoader = new URLLoader();

    xmlLoader.addEventListener(Event.COMPLETE, showXML);
    xmlLoader.addEventListener(ProgressEvent.PROGRESS, traceLoaderXML);

    xmlLoader.load(new URLRequest(xmlURL));

    XML.ignoreWhitespace = true;

    function traceLoaderXML(eventXML:ProgressEvent) {

    pcentXML = int(eventXML.bytesLoaded / eventXML.bytesTotal * 100);

    }
    function showXML(e:Event):void {
    websiteXML = new XML(e.target.data);
    _root.gotoAndPlay(3);
    popupFunction();
    setTimeout(MovieClip(root).splash.IconChanger, 100);
    setTimeout(MovieClip(root).splash.addSplash, 1500);

    st.volume = 0;

    }
    }

    public function popupFunction() {

    addEventListener( 'privacy', onSwitchPrivacy);
    addEventListener( 'switchPopup', onSwitchPopup);

    function onSwitchPrivacy(event:TemplateEvent):void {
    var targetPage:Number = event.info[0];
    privacyPage.privacyPage1.popapTitle = MovieClip(root).websiteXML.section.(@name == "privacyPolicy").item.(@name == "pageTitle");
    privacyPage.privacyPage1.popapInfo = MovieClip(root).websiteXML.section.(@name == "privacyPolicy").item.(@name == "pageText");
    privacyPage.privacyPage1.play();

    }

    function onSwitchPopup(event:TemplateEvent):void {
    var targetPage:Number = event.info[0];

    MovieClip(root).privacyPage.privacyPage1.popapTitl e = websiteXML.pages.pagePopup.popup[targetPage].item.(@name == "title");
    MovieClip(root).privacyPage.privacyPage1.popapInfo = websiteXML.pages.pagePopup.popup[targetPage].item.(@name == "linkText");
    MovieClip(root).privacyPage.privacyPage1.play();
    }

    }

    ///////////////////////////////////////////////////////
    // _PUBLIC FUNCTION //
    ///////////////////////////////////////////////////////
    public function GalleryProjectNew()
    {

    // gallery = new Gallery(MovieClip(root));
    // addChildAt(gallery, 1);

    }

    public function addGallery()
    {
    //gallery.addGalleryImages();
    }

    public function CellsGallery() {
    //gallery.CellsTransormGallery();
    }

    //////////////////////////////////////////////////////
    // END _PUBLIC FUNCTION ///
    //////////////////////////////////////////////////////

    public function textLinkClick( event:TextEvent ):void {
    var tEvent:TemplateEvent=TemplateUtils.getTEventFromSt ring(event.text,true);
    if (tEvent) {
    dispatchEvent( tEvent );
    }
    }

  7. #7
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    (segue)
    ////////////////////////////////////////////////////////

    public function buttonName(textField:TextField, numButton:Number) {

    textField.htmlText = websiteXML.menu.button[numButton].text();

    }

    public function buttonNameSplash(textField:TextField, numButton:Number) {

    textField.htmlText = websiteXML.Splashmenu.button[numButton].text();

    }

    public function settingsText(textField:TextField, nameText:String) {

    textField.htmlText = websiteXML.settings.item.(@name == nameText);
    textField.addEventListener( TextEvent.LINK, textLinkClick );

    }

    public function randomRange(min:Number,max:Number,isRound:Boolean= true):Number {
    var res:Number ;
    if(isRound){
    res = Math.round(Math.random()*(max-min)+min); }else { res = Math.random() * (max - min) + min; }

    return res;
    }
    //////////////////////////////////////////////

    /////////////////////////////////////////////
    public function pageMouseButton(namePanel:MovieClip, startPlay:String, endPlay:String,numButton:Number, numGallery:Number){

    namePanel.buttonMode = true;
    namePanel.addEventListener(MouseEvent.ROLL_OVER, mouseOverButton);
    namePanel.addEventListener(MouseEvent.ROLL_OUT, mouseOutButton);

    namePanel.addEventListener(MouseEvent.CLICK, clicButton);

    function mouseOverButton(e:MouseEvent) {
    if (_root.linkPage !== numButton){
    MovieClip(namePanel.parent).gotoAndPlay(startPlay) ;
    }
    }

    function mouseOutButton(e:MouseEvent) {
    if (_root.linkPage !== numButton){
    MovieClip(namePanel.parent).gotoAndPlay(endPlay);
    }
    }

    function clicButton(e:MouseEvent) {
    if (_root.linkPage !== numButton && animation) {
    if(linkPage==0){
    MovieClip(root).splashMain.gotoAndPlay("hide");
    MovieClip(root).splash.removeSplash();
    }

    MovieClip(namePanel.parent.parent)['itemButton_' + _root.linkPage].gotoAndPlay(endPlay);

    _root.titleGallery = numGallery;
    _root.linkPage = numButton;
    if (linkPage == 0) { setTimeout(MovieClip(root).splash.addSplash, 500);
    MovieClip(root).splashMain.gotoAndPlay("show");
    }
    MovieClip(root).mcMenuItems.mcMenuItems1['itemButton_' + _root.linkPage].gotoAndPlay("s1");
    _root.mcAboutPage.play();

    }
    }
    }

    //////////////////////////////////////////////////////////////////
    public function logoButton(namePanel:MovieClip, startPlay:String, endPlay:String,numButton:Number, numGallery:Number){
    namePanel.buttonMode = true;

    namePanel.addEventListener(MouseEvent.CLICK, clicButton);

    function clicButton(e:MouseEvent) {



    if (linkPage!== 0) {
    MovieClip(root).splashMain.gotoAndPlay("show");
    //chargeValue = 0;
    setTimeout(MovieClip(root).splash.addSplash, 500);
    MovieClip(root).mcMenuItems.mcMenuItems1['itemButton_' + _root.linkPage].gotoAndPlay("s2");
    _root.linkPage = 0;

    MovieClip(root).mcMenuItems.mcMenuItems1['itemButton_' + _root.linkPage].gotoAndPlay("s1");

    isGall = false;

    _root.mcAboutPage.play();
    }


    }
    }
    //////////////////////////////////////////////////////////////////
    public function textContent(nameText:TextField, numText:Number) {
    nameText.htmlText = websiteXML.pages.titlePage[MovieClip(root).linkPage].texts.pageText[numText].text();
    nameText.addEventListener( TextEvent.LINK, textLinkClick );
    nameText.condenseWhite = true;

    }

    public function textScrollContent(nameText:TextField, numText:Number) {
    nameText.htmlText = websiteXML.pages.titlePage[MovieClip(root).linkPage].texts.pageList[numText].text();
    }
    /////////////////////////////////////

    public function fullScreenFunction(nameMovieClip:MovieClip, typeMovie:String=null) {

    var startPageWidth:Number = stage.stageWidth;
    var startPageHeight:Number = stage.stageHeight;

    var xPoz:Number = Math.round(stage.stageWidth - nameMovieClip.x);
    var yPoz:Number = Math.round(stage.stageHeight - nameMovieClip.y);

    stage.addEventListener(Event.RESIZE, appResizeHandler);

    function appResizeHandler(event:Event):void {

    if (typeMovie == 'gallery') {
    Tweener.addTween(nameMovieClip, { x:Math.round((startPageWidth/2)), time:0.7, delay:0.1 } );
    }

    if (typeMovie == 'center') {

    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight/2), time:0.7, delay:0.1});
    }

    if (typeMovie == 'down') {

    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight), time:0.7, delay:0.1});

    }
    if (typeMovie == 'downCenter') {

    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight), time:0.7, delay:0.1});

    }
    if (typeMovie == 'upCenter') {
    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    }

    if (!typeMovie) {

    Tweener.addTween(nameMovieClip, { xstage.stageWidth - xPoz), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip, { ystage.stageHeight - yPoz), time:0.7, delay:0.1 } );

    }
    }

    if (typeMovie == 'gallery') {
    Tweener.addTween(nameMovieClip, { x:Math.round((startPageWidth/2)), time:0.7, delay:0.1 } );
    }

    if (typeMovie == 'center') {
    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight/2), time:0.7, delay:0.1});
    }

    if (typeMovie == 'down') {
    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight), time:0.7, delay:0.1});

    }
    if (typeMovie == 'downCenter') {
    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip,{y:Math.round(stage .stageHeight), time:0.7, delay:0.1});
    }
    if (typeMovie == 'upCenter') {
    Tweener.addTween(nameMovieClip, { x:Math.round(stage.stageWidth/2), time:0.7, delay:0.1 } );
    }

    if (!typeMovie) {
    Tweener.addTween(nameMovieClip, { xstage.stageWidth - xPoz), time:0.7, delay:0.1 } );
    Tweener.addTween(nameMovieClip, { ystage.stageHeight - yPoz), time:0.7, delay:0.1 } );
    }

    }
    ////////////////////////////SOUND FULLSCREEN CONRROLL FUNCTION ////////////////////////////////////////////////////////////////
    public function soundControll(nameButton:MovieClip) {

    nameButton.buttonMode = true;

    nameButton.addEventListener(MouseEvent.CLICK, clicButton);

    function clicButton(e:MouseEvent) {

    if (soundTitle) {

    MovieClip(nameButton).gotoAndStop('on');
    soundTitle = false;
    Tweener.addTween(st, {
    volume:0,
    time:2,
    onUpdate: updateSoundVolume } );

    }else {

    MovieClip(nameButton).gotoAndStop('off');
    soundTitle = true;
    Tweener.addTween(st, {
    volume:1,
    time:2, onUpdate:
    updateSoundVolume} );

    }
    }

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    segue...
    function updateSoundVolume():void {
    MovieClip(root).soundTransform=st;
    }
    }

    public function FullControll(nameButton:MovieClip) {

    nameButton.mcUnder.buttonMode = true;

    nameButton.addEventListener(MouseEvent.CLICK, clicfullScreen);
    nameButton.addEventListener(MouseEvent.ROLL_OVER, overfullScreen);
    nameButton.addEventListener(MouseEvent.ROLL_OUT, outfullScreen);
    ////////////////////////////////////////////////////////////

    function clicfullScreen(e:MouseEvent) {

    if (fullTitle) {

    MovieClip(nameButton).gotoAndPlay('off');
    fullTitle = false;
    stage.displayState=StageDisplayState.FULL_SCREEN;

    }else {
    MovieClip(nameButton).gotoAndPlay('on');
    fullTitle = true;
    stage.displayState=StageDisplayState.NORMAL;
    }
    }
    function overfullScreen(e:MouseEvent) {
    //MovieClip(root).fullScreenSound.mcfullscreenFrame. gotoAndPlay('out');
    }
    function outfullScreen(e:MouseEvent) {
    //MovieClip(root).fullScreenSound.mcfullscreenFrame. gotoAndPlay('over');
    }

    }
    ///////////////////////////////////
    public function soundFunction(nameSound:Object, volumeSound:Number) {

    var channel:SoundChannel = nameSound.play();
    var vol:SoundTransform = channel.soundTransform;
    vol.volume = volumeSound;
    channel.soundTransform = vol;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////////
    public function contactFormAction(form:MovieClip,clearButton:Movie Clip,sendButton:MovieClip,maxTitleText:Number):voi d {

    var iForm:Number = 0;
    clearButton.textMov.thisText.htmlText = websiteXML.pages.titlePage[4].texts.contatcForm.button.text[0].text();
    sendButton.textMov.thisText.htmlText = websiteXML.pages.titlePage[4].texts.contatcForm.button.text[1].text();

    clearButton.textMov.thisText.autoSize = TextFieldAutoSize.LEFT;
    sendButton.textMov.thisText.autoSize = TextFieldAutoSize.LEFT;
    clearButton.addEventListener( MouseEvent.CLICK, clearClick );

    while (iForm <= maxTitleText) {
    //form['NameformItem_' + iForm].htmlText = websiteXML.pages.titlePage[8].texts.contatcForm.titleTextForm.textForm[iForm].text();

    // form['NameformItem_' + iForm].restrict = '^a-z';
    // form['NameformItem_' + iForm].autoSize = TextFieldAutoSize.LEFT;
    form['formItem_' + iForm].addEventListener( FocusEvent.FOCUS_IN, onFormItemFocusIn);
    form['formItem_' + iForm].addEventListener( FocusEvent.FOCUS_OUT, onFormItemFocusOut);
    form['formItem_' + iForm].htmlText = websiteXML.pages.titlePage[4].texts.contatcForm.titleTextForm.textForm[iForm].text();

    formItems[ iForm ] = websiteXML.pages.titlePage[4].texts.contatcForm.titleTextForm.textForm[iForm].text();
    trace(formItems);
    iForm++;
    }

    xmlFormLoader= new URLLoader();
    xmlFormLoader.addEventListener(Event.COMPLETE, showformXML);
    xmlFormLoader.load(new URLRequest(titleFormXML));
    XML.ignoreWhitespace = true;

    function showformXML(e:Event) {
    confXML = new XML(xmlFormLoader.data);
    sendButton.addEventListener( MouseEvent.CLICK, sendClick );

    }

    /////////////////////////////SENDCLICK/////////////////////////////////////////////
    function sendClick( event:MouseEvent ):Boolean {

    form.formMessage.text = "";

    if (stage.displayState==StageDisplayState.FULL_SCREEN ) {

    //stage.displayState=StageDisplayState.NORMAL;
    form.formMessage.text = confXML.exitFullScreenMsg;
    }

    var iForm:uint = 0;
    var notValidated:Boolean = false;
    while (iForm <= maxTitleText) {

    var error:String = validateFields(iForm);
    if (error != ""){
    form.formMessage.text = error;
    notValidated = true;
    break;
    }
    iForm++;
    }

    if ( confXML && !notValidated ) {
    form.formMessage.text=confXML.formProcessingText;
    var formData:Array = new Array();

    formData.push( { key: "Full Name", value: form['formItem_' + 0].text, id : 0 } );
    formData.push( { key: "Mail", value: form['formItem_' + 1].text, id : 1 } );
    formData.push( { key: "Message", value: form['formItem_' + 2].text, id : 2 } );

    var variables:URLVariables = new URLVariables();
    var loader:URLLoader = new URLLoader();
    loader.addEventListener( Event.COMPLETE, onServerResponse );
    loader.addEventListener(IOErrorEvent.IO_ERROR, onServerError);

    var mailFromId : Number = Number( confXML.emailFromSource );
    if( mailFromId && mailFromId > 0 ) {
    variables['mail_from'] = formData[ mailFromId ]['value'];
    } else {
    variables['mail_from'] = confXML.emailFromSource;
    }
    var mailSubjectId : Number = Number( confXML.subjectSource );
    if(mailSubjectId && mailSubjectId > 0) {
    variables['mail_subject'] = formData[ mailSubjectId ]['value'];
    } else {
    variables['mail_subject'] = confXML.subjectSource;
    }
    var mailToId : Number = Number( confXML.emailTo.valueOf().toString() );
    if(mailToId && mailToId > 0) {
    variables['mail_to'] = formData[mailToId]['value'];
    } else {
    variables['mail_to'] = confXML.emailTo;
    }
    variables['plain_text'] = confXML.plainText;
    variables['smtp_server'] = confXML.smtpServer;
    variables['smtp_port'] = confXML.smtpPort;

    for( var j:Number=formData.length-1; j>=0; j-- ) {
    variables[ formData[j]['key'] ] = formData[j]['value'];
    }

    var handlerFilePath:String = confXML.serverProcessorFileName.valueOf().toString () + '.' + confXML.serverProcessorType.valueOf().toString();
    var request:URLRequest = new URLRequest( handlerFilePath );
    request.method = URLRequestMethod.POST;
    request.data = variables;

    try
    {
    loader.load(request);
    }
    catch (error:Error)
    {
    trace( 'Unable to load URL' );
    }
    }

    return true;

    }

    function validateFields(formItem:Number):String{

    var iFormClear:Number = 0;
    var oPatterns:Object = {"text":"^[a-z0-9_-]+$", "e-mail":"^([a-z0-9_\.-]+)@([a-z0-9_\.-]+)\.([a-z\.]{2,6})$", "digits":"^[0-9_-]+$"};
    var oErrorMessages:Object = {"empty":confXML.validationMessages.empty, "text":confXML.validationMessages.ntext, "e-mail":confXML.validationMessages.email, "digits":confXML.validationMessages.digits};

    var isRequired:String = websiteXML.pages.titlePage[4].texts.contatcForm.fieldsValidationTypes.validatio nType[formItem].@required;

    if((isRequired == "true") && (form['formItem_' + formItem].text == "")) {return oErrorMessages["empty"];}
    else if (form['formItem_' + formItem].text != "") {

    if (websiteXML.pages.titlePage[4].texts.contatcForm.fieldsValidationTypes.validatio nType[formItem].text() != "no")
    {
    var pattern:RegExp = new RegExp(oPatterns[websiteXML.pages.titlePage[4].texts.contatcForm.fieldsValidationTypes.validatio nType[formItem].text()], "i");

    var txt:String = form['formItem_' + formItem].text;

    var ar:Array = txt.match(pattern);

    if (ar == null){

    return oErrorMessages[websiteXML.pages.titlePage[4].texts.contatcForm.fieldsValidationTypes.validatio nType[formItem].text()];

    }
    }
    }
    return "";
    }
    ////////////////////////////////RESET///////////////////////////////////
    function clearClick():void {
    var iFormClear:Number=0;
    while (iFormClear<=maxTitleText) {
    form['formItem_' + iFormClear].htmlText = '';
    form['formItem_'+iFormClear].htmlText = websiteXML.pages.titlePage[4].texts.contatcForm.titleTextForm.textForm[iFormClear].text();
    form.formMessage.text='';
    iFormClear++;
    }
    }
    /////////////////////////////////////////////////////////////////
    function onServerResponse( event:Event ):void {
    var loader:URLLoader = URLLoader( event.target );

    try {
    if ( Number( XML( loader.data ).mail ) == 1 || XML( loader.data ).mail == "1" ) {
    form.formMessage.text = confXML.messageSentText;
    } else {
    form.formMessage.text = confXML.messageSentFailedText;
    }
    } catch( error:Error ) {
    form.formMessage.text = confXML.messageSentFailedText;
    }
    }

    function onServerError(event:Event):void {
    form.formMessage.text = confXML.messageSentFailedText;
    }

    function onFormItemFocusIn( event:FocusEvent ):void {
    var formItem:TextField=event.target as TextField;
    var formItemID:uint = uint(formItem.name.slice(formItem.name.lastIndexOf ('_') + 1, formItem.name.length));

    if (formItem.text==formItems[formItemID]) {
    formItem.text='';
    }
    if (stage.displayState==StageDisplayState.FULL_SCREEN ) {

    form.formMessage.text = confXML.exitFullScreenMsg;
    }

    }

    function onFormItemFocusOut( event:FocusEvent ):void {

    var sError:String = validateFields(formItemID);

    var formItem:TextField=event.target as TextField;
    var formItemID:uint=uint(formItem.name.slice(formItem. name.lastIndexOf('_')+1,formItem.name.length));
    if (formItem.text=='') {
    formItem.text=formItems[formItemID];
    }

    if (sError != ""){

    form.formMessage.text = sError;

    } else {form.formMessage.text = ""};

    }
    }

    }
    }

    fine

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2011
    Messaggi
    14
    Qualcuno mi può aiutare?

  10. #10
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930
    Caspita mica facile così, comunque scusa ma negli script che hai postato secondo il mio modestissimo parere c'è un gran caos, io credo che li non possa funzionare niente c'è as2 mischiato ad as3, ma come è possibile?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.