Problem changing a var .source

Hello expert AS3! How are you?

Well, here I am with another problem to solve.

I have a charger added to my step and then I'm trying to change its source with .source (as a string). Here is the code:

var folioLoader:Loader = new Loader();
folioLoader.load (new URLRequest("portfolio/datto.png"));
folioLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, folioLoaded);
function folioLoaded(e:Event):void {}
stage.addChildAt (folioLoader, 0);
folioLoader.source="portfolio/perfecta.png '; //here is where I get the 1119: access of possibly undefined property of source... error
Subs.title.Text = "' DATTO: FILE"; "
}

If I comment on this sixth line of code, the ' portfolio/datto.png' image shows, and output will return no error.

So, what I am doing wrong? How am I supposed to change the image charge inside my folioLoader?

I hope it's well explained and thanks for your help!

Here is the code which, hopefully, will help you get started. I'll be honest with you - I don't use a timeline for coding, code is a quick and dirty to demonstrate one way (not the one who should be) to accomplish your task. Basically, it's just a plan of the logic that performs the slide show view. There is plenty of room for improvement and refactoring. You will need to build on that.

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.Loader;

// array of objects that hold slide related metadata, etc.
var slides:Array = [];
var totalImages:int = 0;
// number of loaded images
var numLoaded:int = 0;
// current slide index
var currentSlide:int = 0;
/* XML--------
--------------*/
var XMLLoader:URLLoader = new URLLoader();
// listeners MUST be added BEFORE operation starts!
XMLLoader.addEventListener(Event.COMPLETE, processXML);
XMLLoader.load(new URLRequest("portfolio/portfolio.xml"));

function processXML(e:Event):void {
     var XMLData:XML = new XML(XMLLoader.data);
     XMLLoader.removeEventListener(Event.COMPLETE, processXML);
     XMLLoader = null;
     totalImages = XMLData.title.length();
     var currentSlide:Object;
     for (var i:int = 0; i < totalImages; i++) {
          currentSlide = {
               url: XMLData.images[i],
               title: XMLData.title[i],
               description: XMLData.description[i],
               loader: new Loader()
          };
          slides.push(currentSlide);
          loadFolio(currentSlide);
     }
}

/* PORTFOLIO--
--------------*/
function loadFolio(slide:Object):void {
     var loader:Loader = slide.loader;
     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad);
     loader.load(new URLRequest("portfolio/" + slide.url));
}

function onImageLoad(e:Event):void {
     e.target.removeEventListener(Event.COMPLETE, onImageLoad);
     numLoaded++;
     // if all of them are loaded - show first slide
     if (numLoaded == totalImages) showSlide(0);
}

function showSlide(slideIndex:int):void {
     currentSlide = slideIndex;
     var slide:Object = slides[slideIndex];
     addChild(slide.loader);
     subs.title.text = slide.title;
     subs.sub.text = slide.description;
     slides[slideIndex].loader.x = 50;
     for (var i:int = 0; i < totalImages; i++)
     {
          if (i != slideIndex && contains(slides[i].loader)) removeChild(slides[i].loader);
     }
}

/* SUBMENU----
--------------*/
subs.colapse_btn.addEventListener(MouseEvent.CLICK, showSubs);
function showSubs(e:MouseEvent):void {
     if (subs.expand_btn.v.rotation <= 45) {
          var minus:Tween = new Tween(subs.expand_btn.v, "rotation", Strong.easeOut, subs.expand_btn.v.rotation, 90, 1, true);
          var up:Tween = new Tween(subs, "y", Strong.easeOut, subs.y, 255, .5, true);
     } else {
          var plus:Tween = new Tween(subs.expand_btn.v, "rotation", Strong.easeOut, subs.expand_btn.v.rotation, 0, 1, true);
          var down:Tween = new Tween(subs, "y", Strong.easeOut, subs.y, 295, .5, true);
     }
}

/* ARROWS-----
--------------*/
right_btn.buttonMode = true;
left_btn.buttonMode = true;
right_btn.addEventListener(MouseEvent.CLICK, nextImg);
left_btn.addEventListener(MouseEvent.CLICK, nextImg);

function nextImg(e:MouseEvent):void {
     if (e.currentTarget == right_btn) currentSlide = currentSlide < slides.length - 1 ? currentSlide + 1 : currentSlide;
     else currentSlide = currentSlide > 0 ? currentSlide - 1 : 0;
     showSlide(currentSlide);
}

Tags: Adobe Animate

Similar Questions

  • Change the Image Source programmatically

    Hello

    I have a problem changing my source of image based on a value in a variable.

    The following function gets the shot, but I'm getting a TypeError: Error #1009: cannot access a property or method of a null object reference. error.

    I tried embedding, and the solution you see below (I've found here - as I am chaning to run time http://forums.adobe.com/message/116979#116979), but no luck

    I'm sure its how I am mapping the png, but I can't be sure... any suggestions?  I was banging my head against my desk for centuries on this!

    function (note: track proves that the value to modify the image is correct)

    public void LeversComplete (): void {}

    if (PodContentBase._ProjectDetail.getItemAt (0).) IndustryLeadingMastery is "N")

    trace ("Value" + PodContentBase._ProjectDetail.getItemAt (0).) IndustryLeadingMastery)

    imgIndustry.source = ' / assets/bigcheese.png ";

    else {imgIndustry.source = ' assets/Nocheese.png'}

    }

    Image (note - it is placed as a default - default settings and in fine)

    < mx:Image id = "imgIndustryleadingtechnicalmastery"

    source="assets/bigcheese.png"/ >

    Photo of the Directory Structure:

    path.JPG

    A few questions... The 'id' settings are different in your example.  In your actionscript code, the id is "imgIndustry" but in the mxml the id is "imgIndustryleadingtechnicalmastery".  Pass, how do you know that your image has been created yet, which is often a source of null pointer exceptions.  Whenever I think that this is a problem, I do something like that

    ... AS3...

    [Bindable] public var imageSource:Object;

    ... MXML...

    If in fact the problem is that the image is not created, it will solve it because the image will go and get its source when it is good and ready.

  • PROBLEM changing the value of a variable in my scene movieclip

    Hello
    I have a problem changing the value of a variable in my scene movieclip. I explain: I combobox on my stage containing the categories, and in the scene that I load an xml file containing links to php files that work with the combobox control.
    On the stage I have a movieclip "camera roll" inside this movieclip on the first image I have a php script file selected in the scene of loading. I use a function with a variable load() "theUrl" inside like this: T.load (theUrl);
    In my scene, I want to change the value of "theUrl" within the film of movieClip. I tried filmstrip.theUrl = url; But it does not work

    the xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <slideshow>
    <area title1="10 Last updated" link1="link1.php"/>
    <area title1="special" link1="link2.php"/>
    </slideshow>

    Here is the code on my stage:

    var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    }
    url=link1[whoOn];
    filmstrip.theUrl=url;//<<--HERE
    };
    x.load("category.xml");
    
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    }
    url=link1[whoOn];
    filmstrip.theUrl=url; //<<-----HERE   
    };
    select.addEventListener("change",cbListener);
    
    

    Here is the code inside the clip "film".

    var T:XML = new XML();
    T.ignoreWhite = true;
    T.onLoad = function(xml) { 
    etc etc etc }
    
    T.load(theUrl);    //<<---HERE it still undefined

    the code on the timeline of the film should be placed in a function() (or better, move all your code to the main timeline).  but, if you leave the code on the timeline of the film strip, call the function that contains this code whenever the url changes.

  • Change the data source in my ApplicationModule

    Studio Edition Version 11.1.1.3.0

    I have the following problem:
    in WLS 10.3 I've defined three global DataSource (or several)

    and I have only a single ApplicationModule. Can I change the data source in my ApplicationModule (by code)?

    THX Thomas

    Envoy

  • I use an analog input on a PCI-6224 and are having problems with the clock source

    I use an analog input on a PCI-6224 and are having problems with the clock source. I'm trying samples of 16 different analog inputs very quickly. I have the sample mode: Timed Single Point material. The rate, that I am running is the maximum (250 kHz (15625Hz per channel)). I left the default clock source and trying to taste several times. The analogue input works for a short time (2-3 seconds) and then everything stops. I'm doing something wrong or is there something I'm missing? Any advice would be great.

    That's how you samples using the sample clock clock. If you see a delay then something is wrong with how you track/data visualization.

    Single point NI the hardware is for PID control with a real-time operating system.

  • Problem changing channels in Windows 7 Media Center

    My Windows XP Media Center 2005 machine had a hard drive crash, and so I just replaced with a Windows 7 machine, also with a TV tuner.

    Old set up has worked perfectly, blaster/transmitter infrared has been able to control the cable box - Scientific Atlanta Explorer 2200 to Comcast.

    Set up the new machine, also with the IR Blaster.  New machine can change the channel correctly in 'Live TV'.  It works by pressing a channel upward / channel down, or entering the channel number.

    But when machine is trying to change the channel to start a new record, or jump off the Media Center Guide, it shows that the first digit, and then displays the cable box '? "and does not change the channel.  So I think it's something that the decoder does not correctly or correctly, interpret or Windows has problems, change the signal.

    I have experimented with different requirements of speed of IR and whether or not he must enter/OK but have not been able to make it work.

    Thoughts of what he must try or change then?

    Thanks for any help.

    Update on my original post.  I "think" I have success.  I am now able to change the channel using the guide and the system can change the channel while recording in the background.

    I went from the Scientific American cable on a 'Digital Transport adapter"box that Comcast sent me.  The manufacturer of the box is listed as "Made in China for Technicolor", and is the model number: DCI105COM1.  The box is extremely

    For the settings, I had to use: 3 digits, enter the channel number and the speed of the middle.

    Let's give it a few weeks and see how it works and if there are differences in quality.

  • BlackBerry 10 I bought the second BBQ10, have problem change BBID

    I purchased BBQ10 from a friend and I have a problem changing the user ID. myfriend even forgotten the password and email address has already been disabled. what I would do.

    Hi @john_KSA119

    Let us know if the provided @John_Clark KB help!

    Roughly speaking, simply perform a security wipe of the device that will restore the default settings

    In other words, when the wipe is complete the device you can set the camera like yours, like its brand new.

    I didn't add, you should tell your friend that whenever they give a device they should always remove personal data first by precautionary measure

  • How to change values record source based on the target account

    Hello

    What is the best way to change the record source of the members of the target value. For example, I want to multiply the record with X, if the target account is XXX, C1 is XXXX or if account target YYY and C1 is AAAA. I know using SQL, it you will be very easy, but, at some point to end users should be able to change it.

    Any ideas are appreciated.

    PM

    I think you should take a look at the accounts of logic, because this will help you reach your fitness and will be manageable by the end users.

  • How to find changes in the sources of Table?

    How does the robot know what has changed in a source table without the column LASTMODIFIEDDATE as sources of database?

    Source table cannot do an incremental crawl - they must extract all lines and compare them with the lines previously analyzed (via a hash value "checksum") to see if they have changed.

  • Data changed from different sources

    I have a problem with obtaining data in an AB ML1200 PLC. I'm simplifying this to explain: I have given in reg N7:0 which is the result of a calculation. Lets say

    "N7:0 = TextEntry1.value * 10. All right, but there is an another local HMI, who wrote also in N7:0. Although the value of this local HMI N7:0 illustrates the variation reflected the Calc above the Belvedere, any attempt to change the value N7:0 of the local GUI is substituted by the Calc. I need to be able to change the value of the local HMI and update the "TextEntry1.value" to reflect the change has Lookout. It sounds simple enough, but it is Kickin ' my ass! As a sidenote I would not have this problem if the AB driver on the lookout for the sustained MicroLogix float regs (F) - I was little shocked, that he did not. Any ideas?

    Looks like you need the connection on the remote source. For example, to create a pot. On the properties page, change its source away to the N7:0. It will also be well read and write the connection.

    But you also have to mutiply the value by 10, so you can first create an Alias on N7:0 by right-clicking the driver object and select Edit Configuration data members. Entry of scale, for example, the gross value of 0 to 100 and eng value between 0 and 10, so that this Alias will represent the value of N7:0 / 10. Give a name to this Alias. And then bind source away from the pot to this Alias. Have a try.

  • OBIEE Mapviewer 11.1.1.7.1 cannot change the data source

    Hi all

    I am trying to configure mapviewer on our environment and after

    by clicking on configuration

    Add the DB details

    Save & Restart is updated the file xml but not displayed on the data source tab.

    But where as the other details of DB, I am able to add without problem, then if I click on change by selecting the data source to add/edit the details required to DB I get following error.

    Source of data editing is not yet supported. However, you can delete and re-create it with the new settings.

    and on the Management tab is not showing me any option to add the new source of data manually.

    someone has encountered this problem before. TIA

    Maybe the connection details are wrong, you see something in the Map Viewer logs files?

    under FMW_HOME/Oracle_BI1/bifoundation/jee/mapviewer.ear/web.war/WEB-INF/log/mapviewer.log

  • Problem changing font size

    Hello

    I have been working on a script and I have the following line of code, where I create and change the size of the font of the text just created. However I can't make it work. I can change some other text properties, is why it's me stumping.

    var finishText = thisComp.layers.addText(finishTime);  
        var textProp = finishText.property("Source Text");
        var textDocument = textProp.value;
        textDocument.resetCharStyle();
        textDocument.fontSize = 36;
        textProp.setValue(textDocument);
    

    Help appreciated! Thank you!

    Nathan SUP,

    I tried the following code and it seems that everything is working properly.

    var thisComp = app.project.activeItem;
    var finishText = thisComp.layers.addText("finishTime");
        var textProp = finishText.property("Source Text");
        var textDocument = textProp.value;
        textDocument.resetCharStyle();
        textDocument.fontSize = 50;
        textProp.setValue(textDocument);
    

    Can you tell us your AE version?

  • All of my received emails suddenly changed to the 'Source of the Message' (no HTML) format. How to change their return?

    All of my emails has suddenly changed format in the 'Source of the Message' (no HTML) format. Upcoming new suddenly is back in HTML. Is it possible to convert the received messages to HTML?
    Example of one of them-

    Of the - Thu Feb 19 13:12:54 2015
    X key account: account 1
    X-UIDL: 0MFJMQ-1YIimi1UiS-00ETqm
    X-Mozilla-Status: 0001
    X-Mozilla-Status2: 00000000
    X-Mozilla-keys:
    Return-Path: bounce-857_HTML-206598685-987434-260085-83038@bounce.global.expediamail.com
    Received: from mta.quotitmail.com ([66.231.85.77]) by mx.perfora.net

    (mxeueus001) with ESMTPS (Nemesis) id 0MFJMQ-1YIimi1UiS-00ETqm for
    <[email protected]>; Thu, 19 Feb 2015 01:35:36 +0100
    

    DKIM signature: v = 1; a = rsa-sha1; c = relaxed/relaxed; s = 200608; d =expediamail.com;

    h=From:To:Subject:Date:MIME-Version:Reply-To:Message-ID:Content-Type:Content-Transfer-Encoding; [email protected];
    bh=fNo3DAi3AhVqqOOcWiTDUbWFywc=;
    b=N429V9jQXRGv6C7+5HaLPGqlcgG/TcpFOhv0/Qb8NzGYhs0ZsvLsSmpmxyKD/mdaFhGePrNUpaAP
      +jen5myxsUX3lbr064O2a21h66NUjMHB785XH0FEV6JKm3QdW1u+KHz0szgaxy1CtUSZQk3gjlP1
      MOo6DXu7PV0u0oEd77Q=
    

    Thank you

    Right click on the folder, select Properties, and then on the button repair.

    Be sure to create an exception in your anti-virus analyzes the Thunderbird profile folder.

  • HP G71 Notebook PC: problem changing BIOS

    Hello

    I just posted a question about having 4 GB of memory and the computer showing only 1 GB of physical memory.

    I saw through a post that someone recommended to go into the bios Setup and check a box and type 4096.

    The computer then rebooted and I had problems since.

    I need to be able to come back in my bios and change the setting to the value of the original.

    How do I do that?

    Thank you

    Bud

    Hello @budhines,

    Thank you for visiting the HP Forums! A place where you can find solutions for your problems, with the help of the community!

    I stumbled upon your post on the laptop and wanted to help you! I looked in your question about your HP g71 Notebook and questions with a BIOS error. I recommend to restore the default BIOS settings. You could restore the BIOS withthis document by selecting the reload the default BIOS settings.

    I hope this helps.

    Thank you.

  • Change the ImageView source in C++

    Hi guys

    I'm trying to edit an ImageView in C++ source

    I first link QML and C++, can I change the source as in the reference Images

    toplogo = root->findChild ("toplogo");

    toplogo-> setImageSource(QUrl("assets/images/logo.png"));

    The image exists, however, the program crashes and the log indicates that there is no source.

    I tried QUrl errors for different combinations of URL of the image of logging:

    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>
    qDebug()< "error="" url:"=""><>

    But the newspaper still prints for all attempts:

    URL ERROR: ' invalid URL 'asset:///images/logoideas.png' ":" '.

    Any ideas would be appreciated.

    Pepe

    You must use the property objectName (not the id property) > please see my post above

    in QML

    ImageView {}
    objectName: "'toplogo" "

    }

     

     toplogo-> setImageSource (QUrl("asset:///images/logoideas.png"));)<- app="" crashes="">

    It hangs here probably topLogo is NULL

    If {(topLogo)

     toplogo-> setImageSource (QUrl("asset:///images/logoideas.png"));)

    }

Maybe you are looking for